pub trait RingStorage {
type Item;
// Required methods
fn push(&self, item: Self::Item) -> Result<(), Self::Item>;
fn dequeue(&self) -> Option<Self::Item>;
fn len(&self) -> usize;
fn capacity(&self) -> usize;
// Provided methods
fn is_empty(&self) -> bool { ... }
fn drain_into(&self, out: &mut [Self::Item]) -> usize { ... }
}Expand description
The storage a BoundedQueue drives: a lock-free MPMC ring, in either the
inline StaticRing (no-alloc) or heap Ring (alloc) form. push hands
the item back on a full ring (never blocks); dequeue pops FIFO. The item
type is associated so a BoundedQueue<R> names a single storage rather than
threading a redundant element parameter.
Required Associated Types§
Required Methods§
Provided Methods§
Sourcefn drain_into(&self, out: &mut [Self::Item]) -> usize
fn drain_into(&self, out: &mut [Self::Item]) -> usize
Pop up to out.len() items FIFO into out, returning the count filled.
Default is a dequeue loop; the heap Ring overrides it with its
prefetching batch Drainer.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".