blob: 97806be4889561a8189911d473c3ae345ca6af0d [file] [log] [blame]
struct Counter {
count: u32,
}
impl Counter {
fn new() -> Counter {
Counter { count: 0 }
}
}
// ANCHOR: here
impl Iterator for Counter {
type Item = u32;
fn next(&mut self) -> Option<Self::Item> {
if self.count < 5 {
self.count += 1;
Some(self.count)
} else {
None
}
}
}
// ANCHOR_END: here
fn main() {}