Trait rtic_monotonics::imxrt::prelude::Monotonic

source ·
pub trait Monotonic {
    type Instant: Ord + Copy + Add<Self::Duration, Output = Self::Instant> + Sub<Self::Duration, Output = Self::Instant, Output = Self::Duration> + Sub;
    type Duration: Copy;

    // Required methods
    fn now() -> Self::Instant;
    async fn delay(duration: Self::Duration);
    async fn delay_until(instant: Self::Instant);
    async fn timeout_at<F>(
        instant: Self::Instant,
        future: F,
    ) -> Result<<F as Future>::Output, TimeoutError>
       where F: Future;
    async fn timeout_after<F>(
        duration: Self::Duration,
        future: F,
    ) -> Result<<F as Future>::Output, TimeoutError>
       where F: Future;
}
Expand description

§A monotonic clock / counter definition.

§Correctness

The trait enforces that proper time-math is implemented between Instant and Duration. This is a requirement on the time library that the user chooses to use.

Required Associated Types§

source

type Instant: Ord + Copy + Add<Self::Duration, Output = Self::Instant> + Sub<Self::Duration, Output = Self::Instant, Output = Self::Duration> + Sub

The type for instant, defining an instant in time.

Note: In all APIs in RTIC that use instants from this monotonic, this type will be used.

source

type Duration: Copy

The type for duration, defining a duration of time.

Note: In all APIs in RTIC that use duration from this monotonic, this type will be used.

Required Methods§

source

fn now() -> Self::Instant

Get the current time.

source

async fn delay(duration: Self::Duration)

Delay for some duration of time.

source

async fn delay_until(instant: Self::Instant)

Delay to some specific time instant.

source

async fn timeout_at<F>( instant: Self::Instant, future: F, ) -> Result<<F as Future>::Output, TimeoutError>
where F: Future,

Timeout at a specific time.

source

async fn timeout_after<F>( duration: Self::Duration, future: F, ) -> Result<<F as Future>::Output, TimeoutError>
where F: Future,

Timeout after a specific duration.

Object Safety§

This trait is not object safe.

Implementors§