Expand description
Timer queue item for embassy-executor integrated timer queues
embassy-executor provides the memory needed to implement integrated timer queues. This crate
exists to separate that memory from embassy-executor itself, to decouple the timer queue’s
release cycle from embassy-executor.
This crate contains two things:
TimerQueueItem: The item type that can be requested from the executor. The size of this type can be configured using thetimer-item-size-N-wordsCargo features.- The
TimerQueueItemProvidertrait, which must be implemented (byembassy-executor, most likely) to return theTimerQueueItemassociated with a given waker. It is a unitrait: the implementation is registered globally withtimer_queue_item_provider_impland resolved at link time.
As a queue implementor, you will need to choose one of the timer-item-size-N-words features to
select a queue item size. You can then define your own item type, which must be
#[repr(align(8))] (or less) and must fit into the size you selected.
You can access the TimerQueueItem from a Waker using the from_embassy_waker
method. You can then use the as_ref and as_mut
methods to reinterpret the data stored in the item as your custom item type.
Macros§
- timer_
queue_ item_ provider_ impl - Register a type as the global
TimerQueueItemProviderimplementation.
Structs§
- Timer
Queue Item - The timer queue item provided by the executor.
Traits§
- Timer
Queue Item Provider - Provider of the
TimerQueueItemassociated with a waker.
Functions§
- item_
from_ ⚠waker - Retrieves the
TimerQueueItemreference that belongs to the task of the waker. - try_
item_ ⚠from_ waker - Like
item_from_waker, but returnsNoneinstead of panicking if the waker is not an embassy waker.