pub struct AsyncTimer<T: Timer>(/* private fields */);
Expand description
A wrapped timer that can asynchronously wake up for concurrent deadlines.
The capacity of this timer is determined by the internal PriorityQueue.
Implementations§
Source§impl<T: Timer> AsyncTimer<T>
impl<T: Timer> AsyncTimer<T>
pub fn new(timer: T) -> Self
pub fn reset(&self)
pub fn now(&self) -> T::Instant
pub unsafe fn get_inner<U>(&self, f: impl FnOnce(&mut T) -> U) -> U
Sourcepub fn awaken(&self)
pub fn awaken(&self)
Awaken all timers for which the deadline has passed compared to the time.
Will re-arm the inner RTC with the earliest deadline, if there is one.
Note: call this in the appropriate interrupt handler.
Sourcepub fn wait<'a>(
&'a self,
dur: T::Duration,
) -> Result<Delay<'a, T>, CapacityError>
pub fn wait<'a>( &'a self, dur: T::Duration, ) -> Result<Delay<'a, T>, CapacityError>
Wait at least for a specific duration.
Sourcepub async fn wait_until<'a>(
&'a self,
deadline: T::Instant,
) -> Result<(), CapacityError>
pub async fn wait_until<'a>( &'a self, deadline: T::Instant, ) -> Result<(), CapacityError>
Wait until some time after a specific deadline.
Will immediately return (and never yield) if the deadline has already passed.
Sourcepub fn wait_until_always<'a>(
&'a self,
deadline: T::Instant,
) -> Result<Delay<'a, T>, CapacityError>
pub fn wait_until_always<'a>( &'a self, deadline: T::Instant, ) -> Result<Delay<'a, T>, CapacityError>
Wait until some time after a specific deadline.
Will at least yield once, even if the deadline has already passed.
Auto Trait Implementations§
impl<T> !Freeze for AsyncTimer<T>
impl<T> !RefUnwindSafe for AsyncTimer<T>
impl<T> Send for AsyncTimer<T>
impl<T> Sync for AsyncTimer<T>
impl<T> Unpin for AsyncTimer<T>
impl<T> UnwindSafe for AsyncTimer<T>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more