2 releases

Uses old Rust 2015

0.1.1 May 31, 2017
0.1.0 May 31, 2017

#35 in #deserializer

Download history 827/week @ 2024-07-25 770/week @ 2024-08-01 489/week @ 2024-08-08 503/week @ 2024-08-15 511/week @ 2024-08-22 653/week @ 2024-08-29 976/week @ 2024-09-05 575/week @ 2024-09-12 479/week @ 2024-09-19 766/week @ 2024-09-26 580/week @ 2024-10-03 512/week @ 2024-10-10 451/week @ 2024-10-17 468/week @ 2024-10-24 817/week @ 2024-10-31 483/week @ 2024-11-07

2,352 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

~190–425KB