DitherParallelIteratorExt

Trait DitherParallelIteratorExt 

Source
pub trait DitherParallelIteratorExt<T>: IndexedParallelIterator<Item = T> + Sized
where T: DitherFloat,
{ // Provided methods fn dither(self, min: T, one: T, dither_amplitude: T, seed: u32) -> Vec<T> where T: Send + Sync { ... } fn dither_with<M>( self, min: T, one: T, dither_amplitude: T, method: &M, ) -> Vec<T> where T: Send + Sync, M: LinearRng + Sync { ... } fn simple_dither(self, one: T, seed: u32) -> Vec<T> where T: Number + CastableFrom<f32> + Send + Sync { ... } fn simple_dither_with<M>(self, one: T, method: &M) -> Vec<T> where T: Number + CastableFrom<f32> + Send + Sync, M: LinearRng + Sync { ... } }
Expand description

Parallel iterator adapter trait for dithering operations.

This trait provides methods to apply dithering directly to parallel iterators, allowing for chaining operations with automatic parallelization.

§Examples

let values = vec![0.2f32, 0.5, 0.8];

let result: Vec<f32> = values
    .par_iter()
    .copied()
    .map(|x| x * 0.5)
    .simple_dither(255.0, 42);

Provided Methods§

Source

fn dither(self, min: T, one: T, dither_amplitude: T, seed: u32) -> Vec<T>
where T: Send + Sync,

Apply dithering to all values in the parallel iterator.

Source

fn dither_with<M>( self, min: T, one: T, dither_amplitude: T, method: &M, ) -> Vec<T>
where T: Send + Sync, M: LinearRng + Sync,

Apply dithering with a specific method.

Source

fn simple_dither(self, one: T, seed: u32) -> Vec<T>
where T: Number + CastableFrom<f32> + Send + Sync,

Apply simple dithering to all values in the parallel iterator.

Source

fn simple_dither_with<M>(self, one: T, method: &M) -> Vec<T>
where T: Number + CastableFrom<f32> + Send + Sync, M: LinearRng + Sync,

Apply simple dithering with a specific method.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<I, T> DitherParallelIteratorExt<T> for I
where I: IndexedParallelIterator<Item = T>, T: DitherFloat,

Available on crate feature rayon only.

Automatic implementation for all indexed parallel iterators yielding DitherFloat types.