README.md
1[![](https://img.shields.io/crates/v/humantime-serde.svg)][crates-io]
2[![](https://docs.rs/humantime-serde/badge.svg)][api-docs]
3[![Apache 2.0 licensed](https://img.shields.io/badge/license-Apache2.0-blue.svg)](./LICENSE-APACHE)
4[![MIT licensed](https://img.shields.io/badge/license-MIT-blue.svg)](./LICENSE-MIT)
5
6# humantime-serde
7
8Serde support for the `humantime` crate.
9
10Heavily based on this [fork](https://github.com/tailhook/serde-humantime/tree/serde_wrapper).
11
12## Example
13```rust
14use serde::{Serialize, Deserialize};
15use std::time::{Duration, SystemTime};
16
17#[derive(Serialize, Deserialize)]
18struct Foo {
19 #[serde(with = "humantime_serde")]
20 timeout: Duration,
21 #[serde(default)]
22 #[serde(with = "humantime_serde")]
23 time: Option<SystemTime>,
24}
25```
26
27## License
28
29Licensed under either of
30
31 * Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0)
32 * MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT)
33
34at your option.
35
36### Contribution
37
38Unless you explicitly state otherwise, any contribution intentionally
39submitted for inclusion in the work by you, as defined in the Apache-2.0
40license, shall be dual licensed as above, without any additional terms or
41conditions.
42
43[crates-io]: https://crates.io/crates/humantime-serde
44[api-docs]: https://docs.rs/humantime-serde
45