[][src]Trait sise::Reader

pub trait Reader {
    type Error;
    type String: Into<String> + AsRef<str>;
    type Pos;
    fn read(&mut self) -> Result<ReadItem<Self::String, Self::Pos>, Self::Error>;
fn finish(self) -> Result<(), Self::Error>; }

A trait to allow reading SISE nodes from a generic source. See example from Parser.

Associated Types

type Error

The error type that may be produced while reading.

type String: Into<String> + AsRef<str>

A type that can be either a borrowed as a str or converted into an owned String.

type Pos

A type that represent the position of a node.

Loading content...

Required methods

fn read(&mut self) -> Result<ReadItem<Self::String, Self::Pos>, Self::Error>

Reads from the source. It shall panic if the root node has been completely read (e.g., the ListEnding that matches the first ListBeginning has been read).

fn finish(self) -> Result<(), Self::Error>

Finished 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).

Loading content...

Implementors

impl<'a> Reader for Parser<'a>[src]

type Error = ParseError

type String = &'a str

type Pos = Pos

impl<'a> Reader for TreeReader<'a>[src]

type Error = Infallible

type String = &'a str

type Pos = ()

Loading content...