2 releases

Uses old Rust 2015

0.1.1 May 31, 2017
0.1.0 May 31, 2017

#34 in #deserializer

Download history 345/week @ 2023-12-18 87/week @ 2023-12-25 167/week @ 2024-01-01 379/week @ 2024-01-08 217/week @ 2024-01-15 303/week @ 2024-01-22 502/week @ 2024-01-29 545/week @ 2024-02-05 430/week @ 2024-02-12 266/week @ 2024-02-19 330/week @ 2024-02-26 305/week @ 2024-03-04 507/week @ 2024-03-11 328/week @ 2024-03-18 407/week @ 2024-03-25 526/week @ 2024-04-01

1,777 downloads per month
Used in 3 crates

MIT/Apache

7KB
83 lines

serde-humantime

Build Status

Documentation

A Serde deserializer for Durations using the humantime crate.

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.


lib.rs:

A crate providing Serde deserializers for Durations via the humantime crate.

Examples

You can use the deserialize function with the with or deserialize_with annotations:

extern crate serde_humantime;
extern crate serde;
#[macro_use]
extern crate serde_derive;

use std::time::Duration;

#[derive(Deserialize)]
struct Foo {
    #[serde(with = "serde_humantime")]
    timeout: Duration,
}

Or use the De wrapper type:

extern crate serde_humantime;
extern crate serde;
#[macro_use]
extern crate serde_derive;

use serde_humantime::De;
use std::time::Duration;

#[derive(Deserialize)]
struct Foo {
    timeout: De<Option<Duration>>,
}

Dependencies

~200–445KB