Deciding if bold can start.

This commit is contained in:
Tom Alexander
2022-12-11 02:07:12 -05:00
parent b6b88a7d78
commit bb09ed41a4
3 changed files with 60 additions and 1 deletions

View File

@@ -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> {