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 25536/week @ 2024-07-22 26272/week @ 2024-07-29 27532/week @ 2024-08-05 30960/week @ 2024-08-12 32293/week @ 2024-08-19 30739/week @ 2024-08-26 31083/week @ 2024-09-02 30093/week @ 2024-09-09 31397/week @ 2024-09-16 36717/week @ 2024-09-23 35631/week @ 2024-09-30 40559/week @ 2024-10-07 39857/week @ 2024-10-14 49363/week @ 2024-10-21 44037/week @ 2024-10-28 40910/week @ 2024-11-04

176,030 downloads per month
Used in 99 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

~105–610KB
~12K SLoC