pub(crate) fn parse_duration<'de, D>(deserializer: D) -> Result<Duration, D::Error>
where
    D: Deserializer<'de>,
{
    // TODO(tarcieri): handle 64-bit overflow?
    let nanos = String::deserialize(deserializer)?
        .parse::<u64>()
        .map_err(|e| D::Error::custom(format!("{}", e)))?;

    Ok(Duration::from_nanos(nanos))
}
/// Parse `Duration` from a JSON string containing a nanosecond count
Parse `Duration` from a JSON string containing a nanosecond count
Parse ` Duration ` from a JSON string containing a nanosecond count
pub(crate) fn parse_duration<'de, D>(deserializer: D) -> Result<Duration, D::Error>
where
    D: Deserializer<'de>,
{
    // TODO(tarcieri): handle 64-bit overflow?
    let nanos = String::deserialize(deserializer)?
        .parse::<u64>()
        .map_err(|e| D::Error::custom(format!("{}", e)))?;
    Ok(Duration::from_nanos(nanos))
}
pub ( crate ) fn parse_duration < ' de , D > ( deserializer : D ) -> Result < Duration , D :: Error > where D : Deserializer < ' de > , { // TODO(tarcieri): handle 64-bit overflow? let nanos = String :: deserialize ( deserializer ) ? . parse :: < u64 > ( ) . map_err ( | e | D :: Error :: custom ( format ! ( " " e ) ) ) ? ; Ok ( Duration :: from_nanos ( nanos ) ) }
Parse `Duration` from a JSON string containing a nanosecond count
Parse ` Duration ` from a JSON string containing a nanosecond count
deserializer
D
deserializer
D