Crate duration_flex

Source
Expand description

§Duration Flex

Helper to make it easier to specify duration files. Specially useful in configuration files.

Example:

  • 1 hour and 23 minutes: 1h23m
  • 1 week, 6 days, 23 hours, 49 minutes andd 50 seconds: 1w6d23h49m59s

Supported Time Units

  • Weeks: 2w (2 weeks).
  • Days: 3d (3 days).
  • Hours: 15h (15 hours).
  • Minutes: 5m (5 minutes).
  • Seconds: 30s (30 seconds).

§Usage

Simply call one of the from methods to create an instance:

use duration_flex::DurationFlex;

let df = DurationFlex::try_from("1w6d23h49m59s").unwrap();
println!("{df}");

§Features

  • clap: enable clap support, so it can be used as application arguments.
  • serde: enable serde support.

Structs§

Enums§