remove clone from into_iter
This commit is contained in:
parent
b600b3bafe
commit
9e77a839d3
1 changed files with 13 additions and 14 deletions
|
@ -344,22 +344,21 @@ impl IntoIterator for Yaml {
|
|||
type IntoIter = YamlIter;
|
||||
|
||||
fn into_iter(self) -> Self::IntoIter {
|
||||
YamlIter {yaml: self, index: 0}
|
||||
let mut yaml = self.into_vec().unwrap_or(vec![]);
|
||||
yaml.reverse();
|
||||
YamlIter {yaml: yaml}
|
||||
}
|
||||
}
|
||||
|
||||
pub struct YamlIter {
|
||||
yaml: Yaml,
|
||||
index: usize,
|
||||
yaml: Vec<Yaml>,
|
||||
}
|
||||
|
||||
impl Iterator for YamlIter {
|
||||
type Item = Yaml;
|
||||
|
||||
fn next(&mut self) -> Option<Yaml> {
|
||||
let result = self.yaml[self.index].clone();
|
||||
self.index += 1;
|
||||
Some(result)
|
||||
self.yaml.pop()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue