-
Notifications
You must be signed in to change notification settings - Fork 135
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
RUST-1764 Add HumanReadable
convenience wrapper
#471
Conversation
IMO, we should also remove the option from |
@@ -454,12 +458,16 @@ impl<'de, 'a> serde::de::Deserializer<'de> for &'a mut Deserializer<'de> { | |||
|
|||
self.deserialize_next(visitor, DeserializerHint::RawBson) | |||
} | |||
HUMAN_READABLE_NEWTYPE => { | |||
self.human_readable = true; |
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.
Could this be an issue when a HumanReadable<T>
is nested in a struct with non-wrapped types following it? e.g.
struct Test {
human_readable: HumanReadable<Document>,
non_human_readable: Document,
}
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.
Good catch! I've fixed the logic and updated the test to flag that kind of failure.
SGTM |
RUST-1764
This wrapper removes the need for the
human_readable_serialization
option forCollection
and provides more granular control as well. There could hypothetically also be a use for a correspondingNonHumanReadable
wrapper but I'd prefer to wait on adding that until someone asks for it.