pub struct DurationFlex { /* private fields */ }
Expand description
Type to conveniently specify durations and interoperate with chrono::Duration
.
The correct way of building this, is through one of the from
methods.
With the clap
feature, can be used with [clap
]:
use clap::Args;
use duration_flex::DurationFlex;
#[derive(Args)]
pub struct Arguments {
#[arg(long, default_value_t = Arguments::default().duration)]
duration: DurationFlex,
}
impl Default for Arguments {
fn default() -> Self {
Self { duration: DurationFlex::try_from("1w6d23h49m59s").unwrap() }
}
}
Implementations§
Trait Implementations§
Source§impl Add<TimeDelta> for DurationFlex
impl Add<TimeDelta> for DurationFlex
Source§impl Clone for DurationFlex
impl Clone for DurationFlex
Source§fn clone(&self) -> DurationFlex
fn clone(&self) -> DurationFlex
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for DurationFlex
impl Debug for DurationFlex
Source§impl Display for DurationFlex
impl Display for DurationFlex
Source§impl From<Duration> for DurationFlex
impl From<Duration> for DurationFlex
Source§impl From<DurationFlex> for Duration
impl From<DurationFlex> for Duration
Source§fn from(value: DurationFlex) -> Self
fn from(value: DurationFlex) -> Self
Converts to this type from the input type.
Source§impl From<DurationFlex> for Duration
impl From<DurationFlex> for Duration
Source§fn from(value: DurationFlex) -> Self
fn from(value: DurationFlex) -> Self
Converts to this type from the input type.
Source§impl From<String> for DurationFlex
impl From<String> for DurationFlex
Source§impl From<TimeDelta> for DurationFlex
impl From<TimeDelta> for DurationFlex
Source§impl FromStr for DurationFlex
impl FromStr for DurationFlex
Source§impl PartialEq for DurationFlex
impl PartialEq for DurationFlex
Source§impl Sub<TimeDelta> for DurationFlex
impl Sub<TimeDelta> for DurationFlex
Source§impl TryFrom<&str> for DurationFlex
impl TryFrom<&str> for DurationFlex
impl Copy for DurationFlex
impl Eq for DurationFlex
impl StructuralPartialEq for DurationFlex
Auto Trait Implementations§
impl Freeze for DurationFlex
impl RefUnwindSafe for DurationFlex
impl Send for DurationFlex
impl Sync for DurationFlex
impl Unpin for DurationFlex
impl UnwindSafe for DurationFlex
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more