-
Notifications
You must be signed in to change notification settings - Fork 145
RUST-1748 Convert unsigned serde helpers to use serde_conv #575
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
base: main
Are you sure you want to change the base?
RUST-1748 Convert unsigned serde helpers to use serde_conv #575
Conversation
This reverts commit f81dfd2.
@@ -217,13 +218,18 @@ pub(crate) struct Timestamp { | |||
body: TimestampBody, | |||
} | |||
|
|||
/// Serializes a u32 as an i64. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved this helper from src/serde_helpers.rs
. Its use in the Timestamp serializer cannot be replaced with the new u32::AsI64
implementation since it relies on the optional dependency serde_with (behind serde_with-3 feature flag).
} | ||
|
||
/// Serializes a u32 as an i64. | ||
pub fn serialize_u32_as_i64<S: Serializer>(val: &u32, serializer: S) -> Result<S::Ok, S::Error> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
moved to src/extjson/models.rs
Converted unsigned (
u32
,u64
) converter functions insrc/serde_helpers.rs
to useserde_conv
macro for serializing and deserializing optional and vector fields withserde_with
.<T>
,Option<T>
, andVec<T>
fields (de)serialized using structsu32_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:
SerializeAs
andDeserializeAs
traits to support Optional and Vector conversions in PR #559serde_conv
macro to support Rustdocs, refactored allObjectId
converters in PR #566DateTime
converters PR #570