pub trait IntoModulationTransform<M: Modulation> {
// Required method
fn with_transform<F: Fn(usize, EmitIntensity) -> EmitIntensity>(
self,
f: F
) -> Transform<M, F>;
}
Required Methods§
sourcefn with_transform<F: Fn(usize, EmitIntensity) -> EmitIntensity>(
self,
f: F
) -> Transform<M, F>
fn with_transform<F: Fn(usize, EmitIntensity) -> EmitIntensity>( self, f: F ) -> Transform<M, F>
transform modulation data
§Arguments
f
- transform function. The first argument is index of the element, and the second argument is the value of the element of the original modulation data.
§Example
let m = Static::with_intensity(EmitIntensity::MAX);
assert_eq!(m.calc(), Ok(vec![EmitIntensity::MAX, EmitIntensity::MAX]));
let m = m.with_transform(|i, x| match i {
0 => x / 2,
_ => EmitIntensity::MIN,
});
assert_eq!(
m.calc(),
Ok(vec![EmitIntensity::MAX / 2, EmitIntensity::MIN])
);
Object Safety§
This trait is not object safe.