use crate::number::Number; pub struct Iter { index: usize, data: Vec } impl Iter { pub fn new(data: Vec) -> Iter { Iter { index: 0, data } } } impl Iterator for Iter { type Item = Number; fn next(&mut self) -> Option { self.index += 1; if self.index <= self.data.len() { Some(self.data[self.index - 1]) } else { Some(0.0) } } }