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.
Since
Durations can be created withconst fns, it would be nice ifhumantime::Durationcould also.It would be ideal if
FromandIntocould be const. Since I don't believe that's possible, perhaps the following added tohumantime::Duration:Alternatively, would it be feasible to make the inner
StdDurationpublic (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 theIntoorDeref+Copyimpls).I was excited to discover this crate today, because it is a pretty good fit for
clapderive-style argument parsing, thanks to the addition ofFromStrandDisplay, plus making the command line fields "unit-less" and less error-prone.