Crate jackdauer

source ·
Expand description

Use this crate to easily parse various time formats to durations.

It provides stratight forward functions to parse durations from a textual representation, into std::time::Duration instances. It focuses on providing a simple but deep interface, that’s easy and intuitive to use, while remaining performant.

Installation

Add it as a dependency to your Cargo.toml

[dependencies]
jackdauer = "0.1.0"

Examples

use jackdauer::duration;
use std::time::Duration;

let nanoseconds = duration("1 nanosecond");
let milliseconds = duration("2 milliseconds");
let seconds = duration("3 seconds");
let minutes = duration("4 minutes");
let hours = duration("5 hours");
let day = duration("6 days");
let week = duration("7 weeks");
let month = duration("8 months");
let year = duration("9 months");
let real_big_duration = duration("9 years, 8 months, 7 weeks and 6 days");
let real_small_duration = duration("4 minutes 3 seconds, 2 milliseconds and 1 nanosecond");

Modules

Functions

  • Returns the total number of days contained in the parsed human readable duration.
  • Parses a std::time::Duration from a human readable string of characters.
  • Returns the total number of hours contained in the parsed human readable duration.
  • Returns the total number of milliseconds contained in the parsed human readable duration.
  • Returns the total number of minutes contained in the parsed human readable duration.
  • Returns the total number of months contained in the parsed human readable duration.
  • Returns the total number of nanoseconds contained in the parsed human readable duration.
  • Returns the total number of seconds contained in the parsed human readable duration.
  • Returns the total number of weeks contained in the parsed human readable duration.
  • Returns the total number of years contained in the parsed human readable duration.