pub struct Handoff<M, const N: usize> { /* private fields */ }Expand description
Bounded FIFO between two callbacks running on different
SchedContexts. Generic over message type M (must be
Send for cross-thread executors) and capacity N.
Constructed via Handoff::new; share between callbacks
via std::sync::Arc<Handoff<M, N>>.
Implementations§
Source§impl<M, const N: usize> Handoff<M, N>
impl<M, const N: usize> Handoff<M, N>
Sourcepub fn push(&self, msg: M) -> Result<(), M>
pub fn push(&self, msg: M) -> Result<(), M>
Push a message. Non-blocking on the high-priority side —
returns Err(msg) when the queue is full so the caller
can decide whether to drop, overwrite, or escalate.
O(1) under the internal mutex.
Sourcepub fn pop(&self) -> Option<M>
pub fn pop(&self) -> Option<M>
Pop one message. Returns None when the queue is empty.
O(N) under the internal mutex (shifts the tail of the
heapless::Vec); switch to a true ring buffer if the
dispatcher’s bench shows this as a hotspot.
Trait Implementations§
Auto Trait Implementations§
impl<M, const N: usize> !Freeze for Handoff<M, N>
impl<M, const N: usize> RefUnwindSafe for Handoff<M, N>
impl<M, const N: usize> Send for Handoff<M, N>where
M: Send,
impl<M, const N: usize> Sync for Handoff<M, N>where
M: Send,
impl<M, const N: usize> Unpin for Handoff<M, N>where
M: Unpin,
impl<M, const N: usize> UnsafeUnpin for Handoff<M, N>where
M: UnsafeUnpin,
impl<M, const N: usize> UnwindSafe for Handoff<M, N>
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