5 releases

0.1.4 Apr 4, 2024
0.1.3 Feb 20, 2023
0.1.2 Jan 28, 2022
0.1.1 Dec 1, 2021
0.1.0 Dec 1, 2021

#218 in Encoding

Download history 49363/week @ 2024-10-21 44037/week @ 2024-10-28 40910/week @ 2024-11-04 35066/week @ 2024-11-11 48488/week @ 2024-11-18 39861/week @ 2024-11-25 42901/week @ 2024-12-02 41570/week @ 2024-12-09 38309/week @ 2024-12-16 17581/week @ 2024-12-23 20720/week @ 2024-12-30 39311/week @ 2025-01-06 38110/week @ 2025-01-13 38976/week @ 2025-01-20 51717/week @ 2025-01-27 60414/week @ 2025-02-03

191,016 downloads per month
Used in 121 crates (5 directly)

MIT/Apache

13KB
294 lines

A serde wrapper that can be used to serialize durations as nanoseconds. It's often useful together with serde_json to communicate with JSON protocols.

Example

use std::time::Duration;

pub struct Message {
    #[serde(with = "serde_nanos")]
    expires_in: Duration,
}

lib.rs:

Serde Nanos

Documentation | Github | Crate

A serde wrapper that can be used to serialize timestamps and durations as nanoseconds.

It's often useful together with serde_json to communicate with JSON protocols.

Dependencies

~100–610KB
~11K SLoC