Type Alias MonotonicDuration

Source
pub type MonotonicDuration = Duration<MonotonicTimeline>;
Expand description

A duration on the monotonic timeline.

Aliased Type§

struct MonotonicDuration(/* private fields */);

Implementations

Source§

impl Duration<MonotonicTimeline>

Source

pub fn sleep(self)

Sleep for the given amount of time.

Source§

impl<T> Duration<T>
where T: Timeline,

Source

pub const INFINITE: Duration<T>

Source

pub const INFINITE_PAST: Duration<T>

Source

pub const ZERO: Duration<T>

Source

pub const fn into_nanos(self) -> i64

Returns the number of nanoseconds contained by this Duration.

Source

pub const fn into_micros(self) -> i64

Returns the total number of whole microseconds contained by this Duration.

Source

pub const fn into_millis(self) -> i64

Returns the total number of whole milliseconds contained by this Duration.

Source

pub const fn into_seconds(self) -> i64

Returns the total number of whole seconds contained by this Duration.

Source

pub fn into_seconds_f64(self) -> f64

Returns the duration as a floating-point value in seconds.

Source

pub const fn into_minutes(self) -> i64

Returns the total number of whole minutes contained by this Duration.

Source

pub const fn into_hours(self) -> i64

Returns the total number of whole hours contained by this Duration.

Source

pub const fn from_nanos(nanos: i64) -> Duration<T>

Source

pub const fn from_micros(micros: i64) -> Duration<T>

Source

pub const fn from_millis(millis: i64) -> Duration<T>

Source

pub const fn from_seconds(secs: i64) -> Duration<T>

Source

pub const fn from_minutes(min: i64) -> Duration<T>

Source

pub const fn from_hours(hours: i64) -> Duration<T>

Trait Implementations§

Source§

impl Add<MonotonicInstant> for MonotonicDuration

Source§

type Output = MonotonicInstant

The resulting type after applying the + operator.
Source§

fn add(self, t: MonotonicInstant) -> MonotonicInstant

Performs the + operation. Read more
Source§

impl DurationExt for MonotonicDuration

Source§

fn after_now(self) -> MonotonicInstant

Return a MonotonicInstant which is a MonotonicDuration after the current time. duration.after_now() is equivalent to MonotonicInstant::after(duration). Read more
Source§

impl WakeupTime for MonotonicDuration

Source§

fn into_timer(self) -> Timer

Create a timer based on this time. Read more
Source§

impl<T, U> Add<Instant<T, U>> for Duration<T, U>
where T: Timeline, U: TimeUnit,

Source§

type Output = Instant<T, U>

The resulting type after applying the + operator.
Source§

fn add( self, time: Instant<T, U>, ) -> <Duration<T, U> as Add<Instant<T, U>>>::Output

Performs the + operation. Read more
Source§

impl<T, U> Add for Duration<T, U>
where T: Timeline, U: TimeUnit,

Source§

type Output = Duration<T, U>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: Duration<T, U>) -> <Duration<T, U> as Add>::Output

Performs the + operation. Read more
Source§

impl<T, U> AddAssign for Duration<T, U>
where T: Timeline, U: TimeUnit,

Source§

fn add_assign(&mut self, rhs: Duration<T, U>)

Performs the += operation. Read more
Source§

impl<T, U> Clone for Duration<T, U>
where T: Clone, U: Clone,

Source§

fn clone(&self) -> Duration<T, U>

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<T, U> Debug for Duration<T, U>
where T: Debug, U: Debug,

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl<T, U> Default for Duration<T, U>
where T: Default, U: Default,

Source§

fn default() -> Duration<T, U>

Returns the “default value” for a type. Read more
Source§

impl<S, T, U> Div<S> for Duration<T, U>
where S: Into<i64>, T: Timeline, U: TimeUnit,

Source§

type Output = Duration<T, U>

The resulting type after applying the / operator.
Source§

fn div(self, div: S) -> Duration<T, U>

Performs the / operation. Read more
Source§

impl<T> From<Duration> for Duration<T>
where T: Timeline,

Source§

fn from(dur: Duration) -> Duration<T>

Converts to this type from the input type.
Source§

impl<T, U> FromBytes for Duration<T, U>
where i64: FromBytes, PhantomData<(T, U)>: FromBytes,

§

fn ref_from_bytes( source: &[u8], ) -> Result<&Self, ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, Infallible>>
where Self: KnownLayout + Immutable,

Interprets the given source as a &Self. Read more
§

fn ref_from_prefix( source: &[u8], ) -> Result<(&Self, &[u8]), ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, Infallible>>
where Self: KnownLayout + Immutable,

Interprets the prefix of the given source as a &Self without copying. Read more
§

fn ref_from_suffix( source: &[u8], ) -> Result<(&[u8], &Self), ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, Infallible>>
where Self: Immutable + KnownLayout,

Interprets the suffix of the given bytes as a &Self. Read more
§

fn mut_from_bytes( source: &mut [u8], ) -> Result<&mut Self, ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, Infallible>>
where Self: IntoBytes + KnownLayout,

Interprets the given source as a &mut Self. Read more
§

fn mut_from_prefix( source: &mut [u8], ) -> Result<(&mut Self, &mut [u8]), ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, Infallible>>
where Self: IntoBytes + KnownLayout,

Interprets the prefix of the given source as a &mut Self without copying. Read more
§

fn mut_from_suffix( source: &mut [u8], ) -> Result<(&mut [u8], &mut Self), ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, Infallible>>
where Self: IntoBytes + KnownLayout,

Interprets the suffix of the given source as a &mut Self without copying. Read more
§

fn ref_from_bytes_with_elems( source: &[u8], count: usize, ) -> Result<&Self, ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, Infallible>>
where Self: KnownLayout<PointerMetadata = usize> + Immutable,

Interprets the given source as a &Self with a DST length equal to count. Read more
§

fn ref_from_prefix_with_elems( source: &[u8], count: usize, ) -> Result<(&Self, &[u8]), ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, Infallible>>
where Self: KnownLayout<PointerMetadata = usize> + Immutable,

Interprets the prefix of the given source as a DST &Self with length equal to count. Read more
§

fn ref_from_suffix_with_elems( source: &[u8], count: usize, ) -> Result<(&[u8], &Self), ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, Infallible>>
where Self: KnownLayout<PointerMetadata = usize> + Immutable,

Interprets the suffix of the given source as a DST &Self with length equal to count. Read more
§

fn mut_from_bytes_with_elems( source: &mut [u8], count: usize, ) -> Result<&mut Self, ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, Infallible>>
where Self: IntoBytes + KnownLayout<PointerMetadata = usize> + Immutable,

Interprets the given source as a &mut Self with a DST length equal to count. Read more
§

fn mut_from_prefix_with_elems( source: &mut [u8], count: usize, ) -> Result<(&mut Self, &mut [u8]), ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, Infallible>>
where Self: IntoBytes + KnownLayout<PointerMetadata = usize>,

Interprets the prefix of the given source as a &mut Self with DST length equal to count. Read more
§

fn mut_from_suffix_with_elems( source: &mut [u8], count: usize, ) -> Result<(&mut [u8], &mut Self), ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, Infallible>>
where Self: IntoBytes + KnownLayout<PointerMetadata = usize>,

Interprets the suffix of the given source as a &mut Self with DST length equal to count. Read more
§

fn read_from_bytes(source: &[u8]) -> Result<Self, SizeError<&[u8], Self>>
where Self: Sized,

Reads a copy of Self from the given source. Read more
§

fn read_from_prefix( source: &[u8], ) -> Result<(Self, &[u8]), SizeError<&[u8], Self>>
where Self: Sized,

Reads a copy of Self from the prefix of the given source. Read more
§

fn read_from_suffix( source: &[u8], ) -> Result<(&[u8], Self), SizeError<&[u8], Self>>
where Self: Sized,

Reads a copy of Self from the suffix of the given source. Read more
Source§

impl<T, U> FromZeros for Duration<T, U>
where i64: FromZeros, PhantomData<(T, U)>: FromZeros,

§

fn zero(&mut self)

Overwrites self with zeros. Read more
§

fn new_zeroed() -> Self
where Self: Sized,

Creates an instance of Self from zeroed bytes. Read more
Source§

impl<T, U> Hash for Duration<T, U>
where T: Hash, U: Hash,

Source§

fn hash<__H>(&self, state: &mut __H)
where __H: Hasher,

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl<T, U> IntoBytes for Duration<T, U>
where i64: IntoBytes, PhantomData<(T, U)>: IntoBytes,

§

fn as_bytes(&self) -> &[u8]
where Self: Immutable,

Gets the bytes of this value. Read more
§

fn as_mut_bytes(&mut self) -> &mut [u8]
where Self: FromBytes,

Gets the bytes of this value mutably. Read more
§

fn write_to(&self, dst: &mut [u8]) -> Result<(), SizeError<&Self, &mut [u8]>>
where Self: Immutable,

Writes a copy of self to dst. Read more
§

fn write_to_prefix( &self, dst: &mut [u8], ) -> Result<(), SizeError<&Self, &mut [u8]>>
where Self: Immutable,

Writes a copy of self to the prefix of dst. Read more
§

fn write_to_suffix( &self, dst: &mut [u8], ) -> Result<(), SizeError<&Self, &mut [u8]>>
where Self: Immutable,

Writes a copy of self to the suffix of dst. Read more
Source§

impl<T, S, U> Mul<S> for Duration<T, U>
where T: Timeline, S: Into<i64>, U: TimeUnit,

Source§

type Output = Duration<T, U>

The resulting type after applying the * operator.
Source§

fn mul(self, mul: S) -> Duration<T, U>

Performs the * operation. Read more
Source§

impl<T, U> Neg for Duration<T, U>
where T: Timeline, U: TimeUnit,

Source§

type Output = Duration<T, U>

The resulting type after applying the - operator.
Source§

fn neg(self) -> <Duration<T, U> as Neg>::Output

Performs the unary - operation. Read more
Source§

impl<T, U> Ord for Duration<T, U>
where T: Ord, U: Ord,

Source§

fn cmp(&self, other: &Duration<T, U>) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl<T, U> PartialEq for Duration<T, U>
where T: PartialEq, U: PartialEq,

Source§

fn eq(&self, other: &Duration<T, U>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<T, U> PartialOrd for Duration<T, U>
where T: PartialOrd, U: PartialOrd,

Source§

fn partial_cmp(&self, other: &Duration<T, U>) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl<T, U> Sub for Duration<T, U>
where T: Timeline, U: TimeUnit,

Source§

type Output = Duration<T, U>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: Duration<T, U>) -> Duration<T, U>

Performs the - operation. Read more
Source§

impl<T, U> SubAssign for Duration<T, U>
where T: Timeline, U: TimeUnit,

Source§

fn sub_assign(&mut self, rhs: Duration<T, U>)

Performs the -= operation. Read more
Source§

impl<T, U> TryFromBytes for Duration<T, U>
where i64: TryFromBytes, PhantomData<(T, U)>: TryFromBytes,

§

fn try_ref_from_bytes( source: &[u8], ) -> Result<&Self, ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>
where Self: KnownLayout + Immutable,

Attempts to interpret the given source as a &Self. Read more
§

fn try_ref_from_prefix( source: &[u8], ) -> Result<(&Self, &[u8]), ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>
where Self: KnownLayout + Immutable,

Attempts to interpret the prefix of the given source as a &Self. Read more
§

fn try_ref_from_suffix( source: &[u8], ) -> Result<(&[u8], &Self), ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>
where Self: KnownLayout + Immutable,

Attempts to interpret the suffix of the given source as a &Self. Read more
§

fn try_mut_from_bytes( bytes: &mut [u8], ) -> Result<&mut Self, ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, ValidityError<&mut [u8], Self>>>
where Self: KnownLayout,

Attempts to interpret the given source as a &mut Self without copying. Read more
§

fn try_mut_from_prefix( source: &mut [u8], ) -> Result<(&mut Self, &mut [u8]), ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, ValidityError<&mut [u8], Self>>>
where Self: KnownLayout,

Attempts to interpret the prefix of the given source as a &mut Self. Read more
§

fn try_mut_from_suffix( source: &mut [u8], ) -> Result<(&mut [u8], &mut Self), ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, ValidityError<&mut [u8], Self>>>
where Self: KnownLayout,

Attempts to interpret the suffix of the given source as a &mut Self. Read more
§

fn try_ref_from_bytes_with_elems( source: &[u8], count: usize, ) -> Result<&Self, ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>
where Self: KnownLayout<PointerMetadata = usize> + Immutable,

Attempts to interpret the given source as a &Self with a DST length equal to count. Read more
§

fn try_ref_from_prefix_with_elems( source: &[u8], count: usize, ) -> Result<(&Self, &[u8]), ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>
where Self: KnownLayout<PointerMetadata = usize> + Immutable,

Attempts to interpret the prefix of the given source as a &Self with a DST length equal to count. Read more
§

fn try_ref_from_suffix_with_elems( source: &[u8], count: usize, ) -> Result<(&[u8], &Self), ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>
where Self: KnownLayout<PointerMetadata = usize> + Immutable,

Attempts to interpret the suffix of the given source as a &Self with a DST length equal to count. Read more
§

fn try_mut_from_bytes_with_elems( source: &mut [u8], count: usize, ) -> Result<&mut Self, ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, ValidityError<&mut [u8], Self>>>
where Self: KnownLayout<PointerMetadata = usize>,

Attempts to interpret the given source as a &mut Self with a DST length equal to count. Read more
§

fn try_mut_from_prefix_with_elems( source: &mut [u8], count: usize, ) -> Result<(&mut Self, &mut [u8]), ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, ValidityError<&mut [u8], Self>>>
where Self: KnownLayout<PointerMetadata = usize>,

Attempts to interpret the prefix of the given source as a &mut Self with a DST length equal to count. Read more
§

fn try_mut_from_suffix_with_elems( source: &mut [u8], count: usize, ) -> Result<(&mut [u8], &mut Self), ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, ValidityError<&mut [u8], Self>>>
where Self: KnownLayout<PointerMetadata = usize>,

Attempts to interpret the suffix of the given source as a &mut Self with a DST length equal to count. Read more
§

fn try_read_from_bytes( source: &[u8], ) -> Result<Self, ConvertError<Infallible, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>
where Self: Sized,

Attempts to read the given source as a Self. Read more
§

fn try_read_from_prefix( source: &[u8], ) -> Result<(Self, &[u8]), ConvertError<Infallible, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>
where Self: Sized,

Attempts to read a Self from the prefix of the given source. Read more
§

fn try_read_from_suffix( source: &[u8], ) -> Result<(&[u8], Self), ConvertError<Infallible, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>
where Self: Sized,

Attempts to read a Self from the suffix of the given source. Read more
Source§

impl<T, U> Copy for Duration<T, U>
where T: Copy, U: Copy,

Source§

impl<T, U> Eq for Duration<T, U>
where T: Eq, U: Eq,

Source§

impl<T, U> Immutable for Duration<T, U>
where i64: Immutable, PhantomData<(T, U)>: Immutable,

Source§

impl<T, U> StructuralPartialEq for Duration<T, U>