-
Notifications
You must be signed in to change notification settings - Fork 46
Description
Since Durations can be created with const fns, it would be nice if humantime::Duration could also.
It would be ideal if From and Into could be const. Since I don't believe that's possible, perhaps the following added to humantime::Duration:
pub const fn new(std: StdDuration) -> Self {
Self(std)
}Alternatively, would it be feasible to make the inner StdDuration public (i.e. pub struct Duration(pub StdDuration))? Then the const initializer wouldn't be strictly necessary, and it would give other convenient ways to access the inner duration (i.e. without using the Into or Deref+Copy impls).
I was excited to discover this crate today, because it is a pretty good fit for clap derive-style argument parsing, thanks to the addition of FromStr and Display, plus making the command line fields "unit-less" and less error-prone.