Crate embassy_executor_timer_queue

Crate embassy_executor_timer_queue 

Source
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 the timer-item-size-N-words Cargo features.
  • The expectation that extern "Rust" fn __embassy_time_queue_item_from_waker(waker: &Waker) -> &mut TimerQueueItem is implemented (by embassy-executor, most likely). This function must return a mutable reference to the TimerQueueItem associated with the given waker.

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.

Structs§

TimerQueueItem
The timer queue item provided by the executor.