Trait BatchStrategy
pub trait BatchStrategy<I>: Send + Sync {
// 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>>;
fn batch_size(&self) -> Option<usize>;
}Expand description
A strategy to batch items.
Required Methods§
fn clone_dyn(&self) -> Box<dyn BatchStrategy<I>>
fn clone_dyn(&self) -> Box<dyn BatchStrategy<I>>
fn batch_size(&self) -> Option<usize>
fn batch_size(&self) -> Option<usize>
Returns the expected batch size for this strategy.
§Returns
The batch size, or None if the strategy doesn’t have a fixed batch size.