#![no_std] pub mod gamma; pub mod rgb; use core::borrow::Borrow; /// An RGB value in physical color space, which should be passed on to an LED for display. /// Not suitable for color operations, since its values won't be perceptually linear. /// See the [rgb] module for the former, and the [gamma] module to convert into this. #[derive(Clone, Copy)] pub struct HardwareRgb(pub u8, pub u8, pub u8); pub trait Lights { type Pixel; fn render(&mut self, pixel: &Self::Pixel); fn latch(&mut self); } pub trait PixelIterator { fn render_to(&mut self, lights: &mut T); } impl PixelIterator for I where I::Item: Borrow { #[inline] fn render_to(&mut self, lights: &mut T) { self.for_each(|pixel| lights.render(pixel.borrow())); } }