Module bson::serde_helpers::u32_as_timestamp [−][src]
Expand description
Contains functions to serialize a u32 as a bson::Timestamp and deserialize a u32 from a bson::Timestamp. The u32 should represent seconds since the Unix epoch.
#[derive(Serialize, Deserialize)]
struct Event {
#[serde(with = "u32_as_timestamp")]
pub time: u32,
}
Functions
Deserializes a u32 from a bson::Timestamp.
Serializes a u32 as a bson::Timestamp.