torrust_tracker_clock::time_extent

Trait Extent

source
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§

source

fn new(unit: &Self::Base, count: &Self::Multiplier) -> Self

It creates a new TimeExtent.

source

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.

source

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.

source

fn total(&self) -> Option<Result<Self::Product, TryFromIntError>>

It returns the total Duration of the TimeExtent.

source

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.

Implementors§