We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
serialize_i64
I am trying to use [serde(serialize_with = "myfunc")] to serialize a std::time::Duration type, where myfunc is defined as:
[serde(serialize_with = "myfunc")]
std::time::Duration
myfunc
fn myfunc<S>(duration: &std::time::Duration, serializer: S) -> Result<S::Ok, S::Error> where S: Serializer, { serializer.serialize_i64(duration.as_millis() as i64) }
When I attempt to serialize the struct with a Duration value of 256 using to_vec_named(), the serialized msgpack contains [cd, 1, 0] for the value.
to_vec_named()
The text was updated successfully, but these errors were encountered:
This is intentional since 23f9b31
Sorry, something went wrong.
Couldn't this "most effective" behavior be made an option? There are some cases where one wants to explicitly encode with a specific type.
No branches or pull requests
I am trying to use
[serde(serialize_with = "myfunc")]
to serialize astd::time::Duration
type, wheremyfunc
is defined as:When I attempt to serialize the struct with a Duration value of 256 using
to_vec_named()
, the serialized msgpack contains [cd, 1, 0] for the value.The text was updated successfully, but these errors were encountered: