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