Skip to main content

Collate

Trait Collate 

Source
pub trait Collate<Sample> {
    type Batch;
    type Error;

    // Required method
    fn collate(
        &mut self,
        samples: Vec<Sample>,
    ) -> Result<Self::Batch, Self::Error>;
}
Expand description

Converts an owned group of samples into one batch.

See DefaultCollator, DefaultConverter, FnCollate, and VecCollate for compiling examples of the built-in implementations.

Required Associated Types§

Source

type Batch

Batch produced from the samples.

Source

type Error

Error returned when collation fails.

Required Methods§

Source

fn collate(&mut self, samples: Vec<Sample>) -> Result<Self::Batch, Self::Error>

Collates samples into one batch.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<Sample, Batch, E, F> Collate<Sample> for FnCollate<F>
where F: FnMut(Vec<Sample>) -> Result<Batch, E>,

Source§

type Batch = Batch

Source§

type Error = E

Source§

impl<Sample> Collate<Sample> for DefaultCollator
where Sample: DefaultCollate,

Source§

impl<Sample> Collate<Sample> for DefaultConverter
where Sample: DefaultConvert,

Source§

impl<Sample> Collate<Sample> for VecCollate

Source§

type Batch = Vec<Sample>

Source§

type Error = !