• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //! Human-friendly time parser and formatter
2 //!
3 //! Features:
4 //!
5 //! * Parses durations in free form like `15days 2min 2s`
6 //! * Formats durations in similar form `2years 2min 12us`
7 //! * Parses and formats timestamp in `rfc3339` format: `2018-01-01T12:53:00Z`
8 //! * Parses timestamps in a weaker format: `2018-01-01 12:53:00`
9 //!
10 //! Timestamp parsing/formatting is super-fast because format is basically
11 //! fixed.
12 //!
13 //! See [humantime-serde] for serde integration (previous crate [serde-humantime] looks unmaintained).
14 //!
15 //! [serde-humantime]: https://docs.rs/serde-humantime/0.1.1/serde_humantime/
16 //! [humantime-serde]: https://docs.rs/humantime-serde
17 
18 #![forbid(unsafe_code)]
19 #![warn(missing_debug_implementations)]
20 #![warn(missing_docs)]
21 
22 mod duration;
23 mod wrapper;
24 mod date;
25 
26 pub use self::duration::{parse_duration, Error as DurationError};
27 pub use self::duration::{format_duration, FormattedDuration};
28 pub use self::wrapper::{Duration, Timestamp};
29 pub use self::date::{parse_rfc3339, parse_rfc3339_weak, Error as TimestampError};
30 pub use self::date::{
31     format_rfc3339, format_rfc3339_micros, format_rfc3339_millis, format_rfc3339_nanos,
32     format_rfc3339_seconds,
33 };
34 pub use self::date::{Rfc3339Timestamp};
35