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

#208 in Encoding

Download history 26955/week @ 2024-08-03 30709/week @ 2024-08-10 32463/week @ 2024-08-17 30827/week @ 2024-08-24 31132/week @ 2024-08-31 29781/week @ 2024-09-07 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 36908/week @ 2024-11-16

166,726 downloads per month
Used in 103 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