[−][src]Crate humantime_serde
Serde support for the humantime
crate.
Based on this fork.
Currently std::time::{Duration, SystemTime}
are supported.
Example
use serde::{Serialize, Deserialize}; use std::time::{Duration, SystemTime}; #[derive(Serialize, Deserialize)] struct Foo { #[serde(with = "humantime_serde")] timeout: Duration, #[serde(default)] #[serde(with = "humantime_serde")] time: Option<SystemTime>, }
Or use the Serde
wrapper type:
use serde::{Serialize, Deserialize}; use humantime_serde::Serde; use std::time::SystemTime; #[derive(Serialize, Deserialize)] struct Foo { timeout: Vec<Serde<SystemTime>>, }
Modules
re | Reexport module. |
Structs
Serde | A wrapper type which implements |
Functions
deserialize | Deserializes a |
serialize | Serializes a |