[][src]Struct ndless_async::timer::TimerListener

pub struct TimerListener { /* fields omitted */ }

Timer Listener

Used to create Timers, which may be .awaited to wait for a specific time. See AsyncListeners to get one.

Implementations

impl TimerListener[src]

pub fn sleep_ms(&self, ms: u32) -> Timer[src]

Sleeps for the specified number of milliseconds. Problems will occur when sleeping for more than 2^31/32768 seconds, which is about 18 hours.

pub fn sleep(&self, dur: Duration) -> Timer[src]

Sleeps for the specified Duration. Problems will occur when sleeping for more than 2^31/32768 seconds, which is about 18 hours.

This function has a resolution of 30 μs.

pub fn sleep_ticks(&self, ticks: u32) -> Timer[src]

Sleeps for the specified number of ticks. Problems will occur when sleeping for more than 2^31 ticks, which is about 18 hours.

pub fn sleep_until(&self, ticks: u32) -> Timer[src]

Sleeps until the current number of ticks is equal to the parameter. Problems will occur when sleeping for more than 2^31 ticks in the future, which is about 18 hours.

pub async fn timeout_ms<'_, T>(
    &'_ self,
    ms: u32,
    f: impl Future<Output = T>
) -> Result<T, TimeoutError>
[src]

Awaits a future or times out after the specified number of milliseconds. Problems will occur when sleeping for more than 2^31/32768 seconds, which is about 18 hours.

pub async fn timeout<'_, T>(
    &'_ self,
    dur: Duration,
    f: impl Future<Output = T>
) -> Result<T, TimeoutError>
[src]

Awaits a future or times out after the specified Duration. Problems will occur when sleeping for more than 2^31/32768 seconds, which is about 18 hours.

This function has a resolution of 30 μs.

pub async fn timeout_ticks<'_, T>(
    &'_ self,
    ticks: u32,
    f: impl Future<Output = T>
) -> Result<T, TimeoutError>
[src]

Awaits a future or times out after the specified number of ticks. Problems will occur when sleeping for more than 2^31 ticks, which is about 18 hours.

pub async fn timeout_until<'_, T>(
    &'_ self,
    ticks: u32,
    f: impl Future<Output = T>
) -> Result<T, TimeoutError>
[src]

Awaits a future or times out after the current number of ticks is equal to the parameter. Problems will occur when sleeping for more than 2^31 ticks in the future, which is about 18 hours.

pub fn every_hz(&self, hz: u32) -> Interval[src]

Creates a Stream that triggers with the specified number of events per second.

pub fn every_ms(&self, ms: u32) -> Interval[src]

Creates a Stream that triggers every specified number of milliseconds. Problems will occur when sleeping for more than 2^31/32768 seconds, which is about 18 hours.

pub fn every(&self, dur: Duration) -> Interval[src]

Creates a Stream that triggers every specified Duration. Problems will occur when sleeping for more than 2^31/32768 seconds, which is about 18 hours.

This function has a resolution of 30 μs.

pub fn every_ticks(&self, ticks: u32) -> Interval[src]

Creates a Stream that triggers every specified number of ticks. Problems will occur when sleeping for more than 2^31 ticks, which is about 18 hours.

Trait Implementations

impl Default for TimerListener[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.