pub trait Extent: Sized + Default {
type Base;
type Multiplier;
type Product;
// Required methods
fn new(unit: &Self::Base, count: &Self::Multiplier) -> Self;
fn increase(&self, add: Self::Multiplier) -> Result<Self, IntErrorKind>;
fn decrease(&self, sub: Self::Multiplier) -> Result<Self, IntErrorKind>;
fn total(&self) -> Option<Result<Self::Product, TryFromIntError>>;
fn total_next(&self) -> Option<Result<Self::Product, TryFromIntError>>;
}Expand description
This trait defines the operations that can be performed on a TimeExtent.
Required Associated Types§
Required Methods§
sourcefn new(unit: &Self::Base, count: &Self::Multiplier) -> Self
fn new(unit: &Self::Base, count: &Self::Multiplier) -> Self
It creates a new TimeExtent.
sourcefn increase(&self, add: Self::Multiplier) -> Result<Self, IntErrorKind>
fn increase(&self, add: Self::Multiplier) -> Result<Self, IntErrorKind>
It increases the TimeExtent by a multiplier.
§Errors
Will return IntErrorKind if add would overflow the internal Duration.
sourcefn decrease(&self, sub: Self::Multiplier) -> Result<Self, IntErrorKind>
fn decrease(&self, sub: Self::Multiplier) -> Result<Self, IntErrorKind>
It decreases the TimeExtent by a multiplier.
§Errors
Will return IntErrorKind if sub would underflow the internal Duration.
sourcefn total(&self) -> Option<Result<Self::Product, TryFromIntError>>
fn total(&self) -> Option<Result<Self::Product, TryFromIntError>>
It returns the total Duration of the TimeExtent.
sourcefn total_next(&self) -> Option<Result<Self::Product, TryFromIntError>>
fn total_next(&self) -> Option<Result<Self::Product, TryFromIntError>>
It returns the total Duration of the TimeExtent plus one increment.
Object Safety§
This trait is not object safe.