draw_helper takes IntoIterator

Update other display types
Macro-Traits
dbr 4 years ago
parent f96caeb419
commit 99b4cff362

@ -25,7 +25,7 @@ impl Default for Display1in54 {
impl Drawing<Color> for Display1in54 {
fn draw<T>(&mut self, item_pixels: T)
where
T: Iterator<Item = Pixel<Color>>,
T: IntoIterator<Item = Pixel<Color>>,
{
self.draw_helper(WIDTH, HEIGHT, item_pixels);
}

@ -25,7 +25,7 @@ impl Default for Display2in9 {
impl Drawing<Color> for Display2in9 {
fn draw<T>(&mut self, item_pixels: T)
where
T: Iterator<Item = Pixel<Color>>,
T: IntoIterator<Item = Pixel<Color>>,
{
self.draw_helper(WIDTH, HEIGHT, item_pixels);
}

@ -27,7 +27,7 @@ impl Drawing<Color> for Display4in2 {
where
T: IntoIterator<Item = Pixel<Color>>,
{
self.draw_helper(WIDTH, HEIGHT, item_pixels.into_iter());
self.draw_helper(WIDTH, HEIGHT, item_pixels);
}
}

@ -47,7 +47,7 @@ pub trait Display: Drawing<Color> {
/// Becomes uneccesary when const_generics become stablised
fn draw_helper<T>(&mut self, width: u32, height: u32, item_pixels: T)
where
T: Iterator<Item = Pixel<Color>>,
T: IntoIterator<Item = Pixel<Color>>,
{
let rotation = self.rotation();
let buffer = self.get_mut_buffer();
@ -124,7 +124,7 @@ impl<'a> Drawing<Color> for VarDisplay<'a> {
where
T: IntoIterator<Item = Pixel<Color>>,
{
self.draw_helper(self.width, self.height, item_pixels.into_iter());
self.draw_helper(self.width, self.height, item_pixels);
}
}

Loading…
Cancel
Save