fn write<T, I>(&mut self, iterator: T) -> Result<(), Self::Error>
    where
        T: Iterator<Item = I>,
        I: Into<Self::Color>,
    {
        let mut i = 0;

        let mut colors = unsafe {
            from_raw_parts_mut(
                self.c_struct.channel[0].leds as *mut [u8; 4],
                self.c_struct.channel[0].count as usize,
            )
        };

        for c in iterator {
            let c_rgb: Self::Color = c.into();
            colors[i] = [c_rgb.b, c_rgb.r, c_rgb.g, 0];
            i = i + 1;
        }

        unsafe {
            return bindings::ws2811_render(&mut self.c_struct).into();
        }

        Ok(())
    }
// Write all the items of an iterator to a ws2812 strip
Write all the items of an iterator to a ws2812 strip
Write all the items of an iterator to a ws2812 strip
fn write<T, I>(&mut self, iterator: T) -> Result<(), Self::Error>
    where
        T: Iterator<Item = I>,
        I: Into<Self::Color>,
    {
        let mut i = 0;
        let mut colors = unsafe {
            from_raw_parts_mut(
                self.c_struct.channel[0].leds as *mut [u8; 4],
                self.c_struct.channel[0].count as usize,
            )
        };
        for c in iterator {
            let c_rgb: Self::Color = c.into();
            colors[i] = [c_rgb.b, c_rgb.r, c_rgb.g, 0];
            i = i + 1;
        }
        unsafe {
            return bindings::ws2811_render(&mut self.c_struct).into();
        }
        Ok(())
    }
fn write < T , I > ( & mut self , iterator : T ) -> Result < ( ) , Self :: Error > where T : Iterator < Item = I > , I : Into < Self :: Color > , { let mut i = 0 ; let mut colors = unsafe { from_raw_parts_mut ( self . c_struct . channel [ 0 ] . leds as * mut [ u8 ; 4 ] , self . c_struct . channel [ 0 ] . count as usize , ) } ; for c in iterator { let c_rgb : Self :: Color = c . into ( ) ; colors [ i ] = [ c_rgb . b , c_rgb . r , c_rgb . g , 0 ] ; i = i + 1 ; } unsafe { return bindings :: ws2811_render ( & mut self . c_struct ) . into ( ) ; } Ok ( ( ) ) }
Write all the items of an iterator to a ws2812 strip
Write all the items of an iterator to a ws2812 strip
&mut self
iterator
T
&mut self
iterator
T