caspervonb / serde_nanos

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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,
}

About

License:Apache License 2.0


Languages

Language:Rust 100.0%