embassy-executor-timer-queue

Crates

git

Versions

default

Flavors

Skip to main content

TimerQueueItemProvider

Trait TimerQueueItemProvider 

Source
pub trait TimerQueueItemProvider {
    // Required methods
    unsafe fn item_from_waker(waker: &Waker) -> &'static mut TimerQueueItem;
    unsafe fn try_item_from_waker(
        waker: &Waker,
    ) -> Option<&'static mut TimerQueueItem>;
}
Expand description

Provider of the TimerQueueItem associated with a waker.

This trait is implemented by the executor (embassy-executor, most likely), which owns the storage for timer queue items.

Required Methods§

Source

unsafe fn item_from_waker(waker: &Waker) -> &'static mut TimerQueueItem

Retrieves the TimerQueueItem reference that belongs to the task of the waker.

Panics if called with a non-embassy waker.

§Safety

The caller must ensure they are not violating Rust’s aliasing rules - it is not allowed to use this method to create multiple mutable references to the same TimerQueueItem at the same time.

This function must only be called in the context of a timer queue implementation.

Source

unsafe fn try_item_from_waker( waker: &Waker, ) -> Option<&'static mut TimerQueueItem>

Like item_from_waker, but returns None instead of panicking if the waker is not an embassy waker.

§Safety

Same as item_from_waker.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§