Struct sise::TreeReader [−][src]
pub struct TreeReader<'a> { /* fields omitted */ }
Expand description
Reader that allows reading from a tree of Node
.
Example
use sise::sise_expr;
use sise::Reader as _;
let root_node = sise_expr!(["test", ["1", "2", "3"]]);
let mut reader = sise::TreeReader::new(&root_node);
assert_eq!(
reader.read().unwrap().kind,
sise::ReadItemKind::ListBeginning,
);
assert_eq!(
reader.read().unwrap().kind,
sise::ReadItemKind::Atom("test"),
);
assert_eq!(
reader.read().unwrap().kind,
sise::ReadItemKind::ListBeginning,
);
assert_eq!(reader.read().unwrap().kind, sise::ReadItemKind::Atom("1"));
assert_eq!(reader.read().unwrap().kind, sise::ReadItemKind::Atom("2"));
assert_eq!(reader.read().unwrap().kind, sise::ReadItemKind::Atom("3"));
assert_eq!(reader.read().unwrap().kind, sise::ReadItemKind::ListEnding);
assert_eq!(reader.read().unwrap().kind, sise::ReadItemKind::ListEnding);
reader.finish().unwrap();
Implementations
Trait Implementations
type Error = Infallible
type Error = Infallible
The error type that may be produced while reading.
A type that can be either borrowed as a str
or converted
into an owned String
. Read more
Reads from the source and returns a ReadItem
. Read more