pub struct BoundedMsgQueue<T> { /* private fields */ }Expand description
Bounded FIFO queue.
Implementations§
Source§impl<T> BoundedMsgQueue<T>
impl<T> BoundedMsgQueue<T>
pub fn new(capacity: usize) -> Self
pub fn with_overflow(capacity: usize, overflow: OverflowStrategy) -> Self
Sourcepub fn push(&mut self, msg: T) -> Result<(), T>
pub fn push(&mut self, msg: T) -> Result<(), T>
Legacy push that mirrors the original signature: returns the
original message if the queue is full. Equivalent to using
OverflowStrategy::Fail.
Sourcepub fn push_with_strategy(&mut self, msg: T) -> PushOutcome<T>
pub fn push_with_strategy(&mut self, msg: T) -> PushOutcome<T>
Push with the configured overflow strategy applied. Returns
PushOutcome::Accepted if the message was enqueued (possibly
after dropping another), PushOutcome::Dropped giving back the
dropped message when DropHead/DropTail kicked in, or
PushOutcome::Rejected when DropNew/Fail refused the push.
pub fn pop(&mut self) -> Option<T>
pub fn is_full(&self) -> bool
pub fn overflow(&self) -> OverflowStrategy
Trait Implementations§
Auto Trait Implementations§
impl<T> Freeze for BoundedMsgQueue<T>
impl<T> RefUnwindSafe for BoundedMsgQueue<T>where
T: RefUnwindSafe,
impl<T> Send for BoundedMsgQueue<T>where
T: Send,
impl<T> Sync for BoundedMsgQueue<T>where
T: Sync,
impl<T> Unpin for BoundedMsgQueue<T>where
T: Unpin,
impl<T> UnsafeUnpin for BoundedMsgQueue<T>
impl<T> UnwindSafe for BoundedMsgQueue<T>where
T: UnwindSafe,
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