pub trait DitherIteratorExt<T>: Iterator<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,
Self: Send,
Self::Item: Send { ... }
fn dither_with<M: LinearRng>(
self,
min: T,
one: T,
dither_amplitude: T,
method: &M,
) -> Vec<T>
where T: Send + Sync,
Self: Send,
Self::Item: Send { ... }
fn simple_dither(self, one: T, seed: u32) -> Vec<T>
where T: Number + CastableFrom<f32> + Send + Sync,
Self: Send,
Self::Item: Send { ... }
fn simple_dither_with<M: LinearRng>(self, one: T, method: &M) -> Vec<T>
where T: Number + CastableFrom<f32> + Send + Sync,
Self: Send,
Self::Item: Send { ... }
}Expand description
Iterator adapter trait for dithering operations.
This trait provides methods to apply dithering directly to iterators, allowing for chaining operations. The trait automatically handles index tracking for deterministic dithering.
§Examples
let values = vec![0.2f32, 0.5, 0.8];
let result: Vec<f32> = values
.iter()
.copied()
.map(|x| x * 0.5)
.simple_dither(255.0, 42);Provided Methods§
fn dither(self, min: T, one: T, dither_amplitude: T, seed: u32) -> Vec<T>
fn dither_with<M: LinearRng>( self, min: T, one: T, dither_amplitude: T, method: &M, ) -> Vec<T>
fn simple_dither(self, one: T, seed: u32) -> Vec<T>
fn simple_dither_with<M: LinearRng>(self, one: T, method: &M) -> Vec<T>
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> DitherIteratorExt<T> for Iwhere
I: Iterator<Item = T>,
T: DitherFloat,
Automatic implementation of DitherIteratorExt for all iterators yielding DitherFloat types.