mirror of
https://github.com/mbilker/kbinxml-rs.git
synced 2026-09-10 03:25:14 -05:00
reader: add Iterator implementation with NodeDefinition output
This commit is contained in:
@@ -250,3 +250,17 @@ impl<'buf> Reader<'buf> {
|
||||
self.data_buf.buf_read()
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> Iterator for Reader<'a> {
|
||||
type Item = NodeDefinition<'a>;
|
||||
|
||||
fn next(&mut self) -> Option<NodeDefinition<'a>> {
|
||||
match self.read_node_definition() {
|
||||
Ok(v) => Some(v),
|
||||
Err(e) => {
|
||||
error!("Error reading node definition in `next()`: {}", e);
|
||||
None
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user