diff --git a/src/iter/ast_node_iter.rs b/src/iter/ast_node_iter.rs index 0ad3093..0abe9d9 100644 --- a/src/iter/ast_node_iter.rs +++ b/src/iter/ast_node_iter.rs @@ -1,4 +1,5 @@ use super::ast_node::AstNode; +use crate::types::Bold; use crate::types::Object; pub enum AstNodeIter<'r, 's> { @@ -67,7 +68,18 @@ impl<'r, 's> Iterator for BoldIter<'r, 's> { type Item = AstNode<'r, 's>; fn next(&mut self) -> Option { - let foo = self.next.next(); - todo!() + self.next.next().map(Into::::into) + } +} + +impl<'r, 's> IntoIterator for &'r Bold<'s> { + type Item = AstNode<'r, 's>; + + type IntoIter = BoldIter<'r, 's>; + + fn into_iter(self) -> Self::IntoIter { + BoldIter { + next: self.children.iter(), + } } }