pub trait BatchStrategy<I>: Send + Sync {
    // Required methods
    fn add(&mut self, item: I);
    fn batch(&mut self, force: bool) -> Option<Vec<I>>;
    fn new_like(&self) -> Box<dyn BatchStrategy<I>>;
}
Expand description

A strategy to batch items.

Required Methods§

source

fn add(&mut self, item: I)

Adds an item to the strategy.

§Arguments
  • item - The item to add.
source

fn batch(&mut self, force: bool) -> Option<Vec<I>>

Batches the items.

§Arguments
  • force - Whether to force batching.
§Returns

The batched items.

source

fn new_like(&self) -> Box<dyn BatchStrategy<I>>

Creates a new strategy of the same type.

§Returns

The new strategy.

Implementors§

source§

impl<I: Send + Sync + 'static> BatchStrategy<I> for FixBatchStrategy<I>