[−][src]Struct ndless_async::timer::TimerListener
Timer Listener
Used to create Timer
s, which may be .await
ed 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]
&'_ self,
ms: u32,
f: impl Future<Output = T>
) -> Result<T, TimeoutError>
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]
&'_ self,
dur: Duration,
f: impl Future<Output = T>
) -> Result<T, TimeoutError>
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]
&'_ self,
ticks: u32,
f: impl Future<Output = T>
) -> Result<T, TimeoutError>
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]
&'_ self,
ticks: u32,
f: impl Future<Output = T>
) -> Result<T, TimeoutError>
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]
Trait Implementations
impl Default for TimerListener
[src]
fn default() -> TimerListener
[src]
Auto Trait Implementations
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,