use no_std_types::color::Color; pub trait Adjust

{ fn adjust(&mut self, map_fn: impl Fn(&P) -> P); } impl Adjust for Color { fn adjust(&mut self, map_fn: impl Fn(&Color) -> Color) { *self = map_fn(self); } } #[cfg(feature = "std")] mod adjust_std { use super::*; use core_types::list::List; use raster_types::{CPU, Raster}; use vector_types::GradientStops; impl Adjust for List> { fn adjust(&mut self, map_fn: impl Fn(&Color) -> Color) { for element in self.iter_element_values_mut() { for color in element.data_mut().data.iter_mut() { *color = map_fn(color); } } } } impl Adjust for List { fn adjust(&mut self, map_fn: impl Fn(&Color) -> Color) { for element in self.iter_element_values_mut() { *element = map_fn(element); } } } impl Adjust for List { fn adjust(&mut self, map_fn: impl Fn(&Color) -> Color) { for element in self.iter_element_values_mut() { element.adjust(&map_fn); } } } impl Adjust for GradientStops { fn adjust(&mut self, map_fn: impl Fn(&Color) -> Color) { for color in self.color.iter_mut() { *color = map_fn(color); } } } }