Add rustfmt.toml and reformat.
This commit is contained in:
34
src/iter.rs
34
src/iter.rs
@ -13,32 +13,32 @@ use crate::{Key, Spline};
|
||||
/// This iterator type is guaranteed to iterate over sorted keys.
|
||||
pub struct Iter<'a, T, V>
|
||||
where
|
||||
T: 'a,
|
||||
V: 'a,
|
||||
T: 'a,
|
||||
V: 'a,
|
||||
{
|
||||
spline: &'a Spline<T, V>,
|
||||
i: usize,
|
||||
spline: &'a Spline<T, V>,
|
||||
i: usize,
|
||||
}
|
||||
|
||||
impl<'a, T, V> Iterator for Iter<'a, T, V> {
|
||||
type Item = &'a Key<T, V>;
|
||||
type Item = &'a Key<T, V>;
|
||||
|
||||
fn next(&mut self) -> Option<Self::Item> {
|
||||
let r = self.spline.0.get(self.i);
|
||||
fn next(&mut self) -> Option<Self::Item> {
|
||||
let r = self.spline.0.get(self.i);
|
||||
|
||||
if let Some(_) = r {
|
||||
self.i += 1;
|
||||
}
|
||||
|
||||
r
|
||||
if let Some(_) = r {
|
||||
self.i += 1;
|
||||
}
|
||||
|
||||
r
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, T, V> IntoIterator for &'a Spline<T, V> {
|
||||
type Item = &'a Key<T, V>;
|
||||
type IntoIter = Iter<'a, T, V>;
|
||||
type Item = &'a Key<T, V>;
|
||||
type IntoIter = Iter<'a, T, V>;
|
||||
|
||||
fn into_iter(self) -> Self::IntoIter {
|
||||
Iter { spline: self, i: 0 }
|
||||
}
|
||||
fn into_iter(self) -> Self::IntoIter {
|
||||
Iter { spline: self, i: 0 }
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user