Skip to main content

TransformFactory

Trait TransformFactory 

Source
pub trait TransformFactory<Input> {
    type Transform: Transform<Input>;
    type Error;

    // Required method
    fn create(
        &self,
        worker: Option<&WorkerContext>,
    ) -> Result<Self::Transform, Self::Error>;
}
Expand description

Constructs one transform for a serial iterator or worker.

Local factories and transforms may remain non-Send on the default serial loader. Selecting positive workers adds the thread-safety bounds.

Required Associated Types§

Source

type Transform: Transform<Input>

Transform instance created by this factory.

Source

type Error

Construction failure.

Required Methods§

Source

fn create( &self, worker: Option<&WorkerContext>, ) -> Result<Self::Transform, Self::Error>

Creates a transform for worker, or for the serial path when None.

A persistent worker receives its pool-lifetime context here. Individual task transforms receive generation cancellation through TaskContext.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§

Source§

impl<Input, T, E, F> TransformFactory<Input> for FnTransformFactory<F>
where T: Transform<Input>, F: Fn(Option<&WorkerContext>) -> Result<T, E>,

Source§

impl<Input, T> TransformFactory<Input> for CloneTransformFactory<T>
where T: Transform<Input> + Clone,

Source§

impl<Input> TransformFactory<Input> for IdentityTransformFactory