Commit 54ec44c7 authored by Luca Barbato's avatar Luca Barbato Committed by Luca Barbato

Extend the implementation of IterWidth

Implement ExactSizeIterator and FusedIterator.
parent aab9c3ed
......@@ -232,7 +232,6 @@ pub struct IterWidth<'a> {
width: usize,
}
// TODO: Implement more methods
impl<'a> Iterator for IterWidth<'a> {
type Item = &'a [u16];
......@@ -250,8 +249,20 @@ impl<'a> Iterator for IterWidth<'a> {
Some(&self.ps.plane.data[base..base + self.width])
}
}
#[inline]
fn size_hint(&self) -> (usize, Option<usize>) {
let size = self.ps.plane.cfg.height - self.ps.y as usize;
(size, Some(size))
}
}
impl<'a> ExactSizeIterator for IterWidth<'a> { }
use std::iter::FusedIterator;
impl<'a> FusedIterator for IterWidth<'a> { }
impl<'a> PlaneSlice<'a> {
pub fn as_slice(&'a self) -> &'a [u16] {
let stride = self.plane.cfg.stride;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment