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

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

A type that represent the position of a node.

Reads from the source and returns a ReadItem. Read more

Finishes the reader, consuming it. It must be called only after the root node has been completely read. It may return an error if an error is encountered after the root node (e.g., trailing tokens at the end of the file). Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.