Expand description

Contains functions to serialize a u64 as an f64 (BSON double) and deserialize a u64 from an f64 (BSON double).

#[derive(Serialize, Deserialize)]
struct FileInfo {
    #[serde(with = "u64_as_f64")]
    pub size_bytes: u64,
}

Functions

  • Deserializes a u64 from an f64 (BSON double). Errors if an exact conversion is not possible.
  • Serializes a u64 as an f64 (BSON double). Errors if an exact conversion is not possible.