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 { if self.count < 5 { self.count += 1; Some(self.count) } else { None } } } // ANCHOR_END: here