changed impl
This commit is contained in:
parent
e5e192a142
commit
09df88c80d
|
@ -1,3 +1,5 @@
|
||||||
|
use std::fmt::Display;
|
||||||
|
|
||||||
use crate::value::Value;
|
use crate::value::Value;
|
||||||
|
|
||||||
/// Single-linked list
|
/// Single-linked list
|
||||||
|
@ -14,8 +16,13 @@ impl<'a> List<'a> {
|
||||||
.rev()
|
.rev()
|
||||||
.fold(Self::Nil, |list, next| Self::Cons(next, Box::new(list)))
|
.fold(Self::Nil, |list, next| Self::Cons(next, Box::new(list)))
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub fn iter(&self) -> Iter<'_, '_> {
|
impl<'l, 'v> IntoIterator for &'l List<'v> {
|
||||||
|
type Item = &'l Value<'v>;
|
||||||
|
type IntoIter = Iter<'l, 'v>;
|
||||||
|
|
||||||
|
fn into_iter(self) -> Self::IntoIter {
|
||||||
Iter(self)
|
Iter(self)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue