draw_helper takes IntoIterator

Update other display types
embedded-hal-1.0
dbr 2019-08-16 23:59:58 +09:30
parent f96caeb419
commit 99b4cff362
4 changed files with 5 additions and 5 deletions

View File

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

View File

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

View File

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

View File

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