mirror of
https://github.com/Anshorei/epd-waveshare.git
synced 2026-10-03 22:06:43 +00:00
draw_helper takes IntoIterator
Update other display types
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user