thinking about other iterator things to add

This commit is contained in:
Chris West (Faux) 2017-07-13 20:10:03 +01:00
parent 00188891eb
commit d1948421ce

View File

@ -80,6 +80,19 @@ where
{
CMap { it: self, f }
}
pub fn count(mut self) -> usize {
// Not sure this is actually better than self.map(|_| ()).count()
let mut count = 0;
while !self.raw.is_end() {
self.raw.next();
count += 1;
}
count
}
}
#[must_use = "iterator adaptors are lazy and do nothing unless consumed"]