pub struct IntrusiveMailbox {
head: AtomicUsize,
pool: NodePool,
}Fields§
§head: AtomicUsize§pool: NodePoolPool of pre-allocated nodes for IRQ-safe push/pop without heap alloc.
Implementations§
Source§impl IntrusiveMailbox
impl IntrusiveMailbox
Sourcepub const fn new_empty() -> Self
pub const fn new_empty() -> Self
Create a new empty mailbox without pre-allocation.
Only for const contexts (e.g., static initialisers); the caller must
call preallocate_nodes() at runtime before use in IRQ context.
Sourcepub fn preallocate_nodes(&self, count: usize)
pub fn preallocate_nodes(&self, count: usize)
Pre-allocate additional nodes at runtime.
Sourcepub fn push(&self, msg: &[u8]) -> Result<(), MailboxError>
pub fn push(&self, msg: &[u8]) -> Result<(), MailboxError>
Push a message onto the mailbox (LIFO : inserted at head).
Tries the pre-allocated node pool first. Falls back to heap
allocation only if the pool is empty. In IRQ context the pool
should never be empty if FREELIST_CAPACITY is large enough.
Sourcepub fn pop(&self) -> Option<IpcMessage>
pub fn pop(&self) -> Option<IpcMessage>
Pop a message from the mailbox (LIFO : from head).
Copies the message data out of the intrusive node, then returns the
node to the pre-allocated pool. The caller receives an owned
IpcMessage value : no pointers into recycled memory.
Trait Implementations§
Source§impl Debug for IntrusiveMailbox
impl Debug for IntrusiveMailbox
Source§impl IpcConsumer for IntrusiveMailbox
impl IpcConsumer for IntrusiveMailbox
Source§impl IpcProducer for IntrusiveMailbox
impl IpcProducer for IntrusiveMailbox
Source§impl IpcTransport for IntrusiveMailbox
impl IpcTransport for IntrusiveMailbox
Source§fn level(&self) -> TransportLevel
fn level(&self) -> TransportLevel
Source§fn capabilities(&self) -> TransportCapabilities
fn capabilities(&self) -> TransportCapabilities
Auto Trait Implementations§
impl !Freeze for IntrusiveMailbox
impl RefUnwindSafe for IntrusiveMailbox
impl Send for IntrusiveMailbox
impl Sync for IntrusiveMailbox
impl Unpin for IntrusiveMailbox
impl UnsafeUnpin for IntrusiveMailbox
impl UnwindSafe for IntrusiveMailbox
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more