Manual implementation of BoldIter.

This commit is contained in:
Tom Alexander 2023-09-27 15:17:56 -04:00
parent df5d699a39
commit 9a1d91ae45
Signed by: talexander
GPG Key ID: D3A179C9A53C0EDE

View File

@ -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<Self::Item> {
let foo = self.next.next();
todo!()
self.next.next().map(Into::<AstNode>::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(),
}
}
}