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
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.