Crate duration_helper

Crate duration_helper 

Source
Expand description

DurationHelper - A Rust crate to simplify the creation of Duration objects.

This library provides a set of helper methods to easily construct std::time::Duration objects from integers and floating point numbers. By mimicking the naming conventions from std::time::Duration, it aims to provide an intuitive way to create durations.

§Examples

use duration_helper::DurationHelper;

let five_seconds = 5.secs();
let two_hours = 2.hours();
let half_a_day = 0.5.days();

§Features

  • Convert numbers directly to Duration objects.
  • Intuitive naming aligned with std::time::Duration.
  • Support for a wide range of time units, from nanoseconds to years.
  • Both integer and floating point number types are supported.

Note: This library makes some assumptions, particularly for larger durations. For example, a month is considered as 30 days and a year is considered as 365 days.

Traits§

DurationHelper