Deciding if bold can start.
This commit is contained in:
@@ -20,6 +20,12 @@ pub struct Node<T> {
|
||||
parent: Option<Rc<Node<T>>>,
|
||||
}
|
||||
|
||||
impl<T> Node<T> {
|
||||
pub fn get_data(&self) -> &T {
|
||||
&self.data
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: This Debug is only needed because of the try_unwrap+expect
|
||||
impl<T: Debug> List<T> {
|
||||
pub fn new() -> Self {
|
||||
@@ -72,6 +78,12 @@ impl<T: Debug> List<T> {
|
||||
(Some(me), Some(them)) => Rc::ptr_eq(me, them),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn iter(&self) -> impl Iterator<Item = &Rc<Node<T>>> {
|
||||
NodeIter {
|
||||
position: &self.head,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub struct NodeIter<'a, T> {
|
||||
|
||||
Reference in New Issue
Block a user