pub struct BoundedStash<M> { /* private fields */ }Expand description
Bounded stash with a configurable overflow policy.
Implementations§
Source§impl<M> BoundedStash<M>
impl<M> BoundedStash<M>
pub fn new(capacity: usize, policy: StashOverflow) -> Self
pub fn capacity(&self) -> usize
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
pub fn is_full(&self) -> bool
Sourcepub fn stash(&mut self, msg: M) -> StashResult<M>
pub fn stash(&mut self, msg: M) -> StashResult<M>
Stash msg, applying the configured overflow policy if
the buffer is full.
Sourcepub fn unstash_all(&mut self) -> Vec<M>
pub fn unstash_all(&mut self) -> Vec<M>
Drain the stash front-to-back. Maintains “messages prepended in order” semantic — caller front-prepends to the mailbox.
Auto Trait Implementations§
impl<M> Freeze for BoundedStash<M>
impl<M> RefUnwindSafe for BoundedStash<M>where
M: RefUnwindSafe,
impl<M> Send for BoundedStash<M>where
M: Send,
impl<M> Sync for BoundedStash<M>where
M: Sync,
impl<M> Unpin for BoundedStash<M>where
M: Unpin,
impl<M> UnsafeUnpin for BoundedStash<M>
impl<M> UnwindSafe for BoundedStash<M>where
M: 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