pub trait DitherParallelIteratorExt<T>: IndexedParallelIterator<Item = T> + Sizedwhere
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§
Sourcefn dither(self, min: T, one: T, dither_amplitude: T, seed: u32) -> Vec<T>
fn dither(self, min: T, one: T, dither_amplitude: T, seed: u32) -> Vec<T>
Apply dithering to all values in the parallel iterator.
Sourcefn dither_with<M>(
self,
min: T,
one: T,
dither_amplitude: T,
method: &M,
) -> Vec<T>
fn dither_with<M>( self, min: T, one: T, dither_amplitude: T, method: &M, ) -> Vec<T>
Apply dithering with a specific method.
Sourcefn simple_dither(self, one: T, seed: u32) -> Vec<T>
fn simple_dither(self, one: T, seed: u32) -> Vec<T>
Apply simple dithering to all values in the parallel iterator.
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§
impl<I, T> DitherParallelIteratorExt<T> for Iwhere
I: IndexedParallelIterator<Item = T>,
T: DitherFloat,
Available on crate feature
rayon only.Automatic implementation for all indexed parallel iterators yielding DitherFloat types.