pub trait Monotonic {
type Instant: Ord + Copy + Add<Self::Duration, Output = Self::Instant> + Sub<Self::Duration, Output = Self::Instant> + Sub<Self::Instant, Output = Self::Duration>;
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: Future>(
instant: Self::Instant,
future: F
) -> Result<F::Output, TimeoutError>;
async fn timeout_after<F: Future>(
duration: Self::Duration,
future: F
) -> Result<F::Output, TimeoutError>;
}
Expand description
Required Associated Types§
sourcetype Instant: Ord + Copy + Add<Self::Duration, Output = Self::Instant> + Sub<Self::Duration, Output = Self::Instant> + Sub<Self::Instant, Output = Self::Duration>
type Instant: Ord + Copy + Add<Self::Duration, Output = Self::Instant> + Sub<Self::Duration, Output = Self::Instant> + Sub<Self::Instant, Output = Self::Duration>
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.
Required Methods§
sourceasync fn delay_until(instant: Self::Instant)
async fn delay_until(instant: Self::Instant)
Delay to some specific time instant.
sourceasync fn timeout_at<F: Future>(
instant: Self::Instant,
future: F
) -> Result<F::Output, TimeoutError>
async fn timeout_at<F: Future>( instant: Self::Instant, future: F ) -> Result<F::Output, TimeoutError>
Timeout at a specific time.
sourceasync fn timeout_after<F: Future>(
duration: Self::Duration,
future: F
) -> Result<F::Output, TimeoutError>
async fn timeout_after<F: Future>( duration: Self::Duration, future: F ) -> Result<F::Output, TimeoutError>
Timeout after a specific duration.
Object Safety§
This trait is not object safe.