Trait vector_stream::batcher::data::BatchData

source ·
pub trait BatchData<T> {
    type Batch;

    // Required methods
    fn len(&self) -> usize;
    fn take_batch(&mut self) -> Self::Batch;
    fn push_item(&mut self, item: T);

    // Provided method
    fn is_empty(&self) -> bool { ... }
}

Required Associated Types§

Required Methods§

source

fn len(&self) -> usize

The number of items in the batch

source

fn take_batch(&mut self) -> Self::Batch

Return the current batch, and reset any internal state

source

fn push_item(&mut self, item: T)

Add a single item to the batch

Provided Methods§

source

fn is_empty(&self) -> bool

Implementations on Foreign Types§

source§

impl<T> BatchData<T> for Vec<T>

§

type Batch = Vec<T>

source§

fn len(&self) -> usize

source§

fn take_batch(&mut self) -> Self::Batch

source§

fn push_item(&mut self, item: T)

Implementors§

source§

impl<F, S, T> BatchData<T> for BatchReduce<F, S>
where F: FnMut(&mut S, T), S: Default,

§

type Batch = S