Trait burn::data::dataloader::BatchStrategy

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>>;
}
Expand description

A strategy to batch items.

Required Methods§

fn add(&mut self, item: I)

Adds an item to the strategy.

§Arguments
  • item - The item to add.

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

Batches the items.

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

The batched items.

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

Creates a new strategy of the same type.

§Returns

The new strategy.

Implementors§

§

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