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

#224 in Encoding

Download history 43338/week @ 2024-11-30 41322/week @ 2024-12-07 39126/week @ 2024-12-14 17480/week @ 2024-12-21 20582/week @ 2024-12-28 38257/week @ 2025-01-04 38733/week @ 2025-01-11 37378/week @ 2025-01-18 52808/week @ 2025-01-25 61773/week @ 2025-02-01 56404/week @ 2025-02-08 52668/week @ 2025-02-15 52305/week @ 2025-02-22 48885/week @ 2025-03-01 55709/week @ 2025-03-08 52253/week @ 2025-03-15

219,798 downloads per month
Used in 127 crates (6 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

~98–600KB
~11K SLoC