+
+pub struct Counter5 {
+ count: u32
+}
+
+impl Counter5 {
+ pub fn new() -> Counter5 {
+ Counter5 { count: 0 }
+ }
+}
+
+impl Iterator for Counter5 {
+ type Item = u32;
+
+ fn next(&mut self) -> Option<Self::Item> {
+ if self.count < 5 {
+ self.count += 1;
+ Some(self.count)
+ } else {
+ None
+ }
+ }
+}