1use crate::{Key, Spline};
10
11pub struct Iter<'a, T, V> where T: 'a, V: 'a {
15 spline: &'a Spline<T, V>,
16 i: usize
17}
18
19impl<'a, T, V> Iterator for Iter<'a, T, V> {
20 type Item = &'a Key<T, V>;
21
22 fn next(&mut self) -> Option<Self::Item> {
23 let r = self.spline.0.get(self.i);
24
25 if let Some(_) = r {
26 self.i += 1;
27 }
28
29 r
30 }
31}
32
33impl<'a, T, V> IntoIterator for &'a Spline<T, V> {
34 type Item = &'a Key<T, V>;
35 type IntoIter = Iter<'a, T, V>;
36
37 fn into_iter(self) -> Self::IntoIter {
38 Iter {
39 spline: self,
40 i: 0
41 }
42 }
43}
44