Browse Source

draw_helper takes IntoIterator

Update other display types
embedded-hal-1.0
dbr 6 years ago
parent
commit
99b4cff362
  1. 2
      src/epd1in54/graphics.rs
  2. 2
      src/epd2in9/graphics.rs
  3. 2
      src/epd4in2/graphics.rs
  4. 4
      src/graphics.rs

2
src/epd1in54/graphics.rs

@ -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);
}

2
src/epd2in9/graphics.rs

@ -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);
}

2
src/epd4in2/graphics.rs

@ -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);
}
}

4
src/graphics.rs

@ -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