pub trait BatchSource {
type Item;
// Required methods
fn drain_batch(&self, out: &mut [Self::Item]) -> usize;
fn len(&self) -> usize;
// Provided method
fn is_empty(&self) -> bool { ... }
}Expand description
A source drained in owned batches through a shared &self, so multiple
consumers may pull disjoint batches concurrently.
Required Associated Types§
Required Methods§
Sourcefn drain_batch(&self, out: &mut [Self::Item]) -> usize
fn drain_batch(&self, out: &mut [Self::Item]) -> usize
Pull up to out.len() items FIFO into out, returning the count filled.
Safe to call from several threads at once — each caller gets a disjoint
batch (the impl linearises the dequeue).
Provided Methods§
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".