Skip to content

RUST-1748 Convert unsigned serde helpers to use serde_conv #573

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed

Conversation

JamieTsai1024
Copy link
Collaborator

@JamieTsai1024 JamieTsai1024 commented Jul 16, 2025

Converted unsigned (u32, u64) converter functions in src/serde_helpers.rs to use serde_conv macro for serializing and deserializing optional and vector fields with serde_with.

  • Added tests for <T>, Option<T>, and Vec<T> fields (de)serialized using structs
  • Added documentation for modules and structs
Old New
u32_as_timestamp u32::AsTimestamp (u32 → Timestamp)
timestamp_as_u32 u32::FromTimestamp (Timestamp → u32)
u32_as_f64 u32::AsF64 (u32 → f64)
serialize_u32_as_i32 u32::AsI32 (u32 → i32)
serialize_u32_as_i64 u32::AsI64 (u32 → i64)
u64_as_f64 u64::AsF64 (u64 → f64)
serialize_u64_as_i32 u64::AsI32 (u64 → i32)
serialize_u64_as_i64 u64::AsI64 (u64 → i64)

Previously:

  • Rewrote serde converters as structs with SerializeAs and DeserializeAs traits to support Optional and Vector conversions in PR #559
  • Adapted serde_conv macro to support Rustdocs, refactored all ObjectId converters in PR #566
  • Refactored all DateTime converters PR #570

@@ -651,95 +651,6 @@ fn test_serialize_deserialize_unsigned_numbers() {
assert!(doc_result.is_err());
}

#[test]
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

new unsigned tests replaces this test

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant