Impl ExactSizeIterator for multi_field_iter.

This commit is contained in:
Tom Alexander 2023-10-10 15:23:04 -04:00
parent ee5ed17c20
commit b7f7876706
Signed by: talexander
GPG Key ID: D3A179C9A53C0EDE

View File

@ -79,7 +79,14 @@ $fieldname: $innertype,
.or_else(|| self.$fieldname.next().map(Into::<AstNode>::into))
),*
}
fn size_hint(&self) -> (usize, Option<usize>) {
let size = self.$firstfieldname.len()$( + self.$fieldname.len() ),*;
(size, Some(size))
}
}
impl<'r, 's> ExactSizeIterator for $itertype<'r, 's> {}
impl<'r, 's> IntoIterator for &'r $astnodetype {
type Item = AstNode<'r, 's>;