Trait BatchStrategy

Source
pub trait BatchStrategy<I>: Send {
    // Required methods
    fn add(&mut self, item: I);
    fn batch(&mut self, force: bool) -> Option<Vec<I>>;
    fn clone_dyn(&self) -> Box<dyn BatchStrategy<I>>;
}
Available on crate features std and dataset only.
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 clone_dyn(&self) -> Box<dyn BatchStrategy<I>>

Creates a new strategy of the same type.

§Returns

The new strategy.

Implementors§

Source§

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