pub struct WriteQueue { /* private fields */ }Expand description
FIFO queue with a hard message-count capacity.
Implementations§
Source§impl WriteQueue
impl WriteQueue
Sourcepub fn new(capacity: usize) -> Self
pub fn new(capacity: usize) -> Self
Create a queue holding at most capacity messages. A capacity of 0 is
clamped to 1 so the queue is always usable.
pub fn capacity(&self) -> usize
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
pub fn is_full(&self) -> bool
Sourcepub fn enqueue(
&mut self,
msg: WriteMsg,
) -> Result<(), (WriteMsg, WriteQueueError)>
pub fn enqueue( &mut self, msg: WriteMsg, ) -> Result<(), (WriteMsg, WriteQueueError)>
Enqueue a message. Returns WriteQueueError::Full without mutating the
queue when at capacity (the message is returned to the caller untouched
so it can be retried after backpressure clears).
Trait Implementations§
Auto Trait Implementations§
impl Freeze for WriteQueue
impl RefUnwindSafe for WriteQueue
impl Send for WriteQueue
impl Sync for WriteQueue
impl Unpin for WriteQueue
impl UnsafeUnpin for WriteQueue
impl UnwindSafe for WriteQueue
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