-
Type: New Feature
-
Resolution: Fixed
-
Priority: Unknown
-
Affects Version/s: None
-
Component/s: BSON
-
None
The crate serde_with provides the SerializeAs and DeserializeAs traits, which we can implement on our types to allow for composable serde(with = "") attributes. These currently aren't supported in vanilla serde.
This will enable the following (which currently isn't possible):
#[serde_as]
#[derive(Debug, Serialize, Deserialize)]
struct MyData {
#[serde_as(as = "Option<bson::DateTime>")
date: Option<chrono::DateTime<Utc>>
}
And this struct will serialize to / from BSON, even though there's an Option wrapper.
Originally reported in GH issue: https://github.com/mongodb/bson-rust/issues/303
- is depended on by
-
RUST-1033 Can't serialize/deserialize uuid properly
- Closed