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

#205 in Encoding

Download history 30819/week @ 2024-09-14 35831/week @ 2024-09-21 36738/week @ 2024-09-28 39568/week @ 2024-10-05 40054/week @ 2024-10-12 49241/week @ 2024-10-19 44918/week @ 2024-10-26 40352/week @ 2024-11-02 35113/week @ 2024-11-09 44894/week @ 2024-11-16 42873/week @ 2024-11-23 43338/week @ 2024-11-30 41322/week @ 2024-12-07 39126/week @ 2024-12-14 17480/week @ 2024-12-21 15845/week @ 2024-12-28

120,947 downloads per month
Used in 111 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