Struct sise::NodeReadUtil

source ·
pub struct NodeReadUtil<'a, 'b> { /* private fields */ }
Expand description

Utility to read nodes.

See as_atom and as_list methods.

Implementations§

Returns the node in this utility.

Returns the position tree of the node in this utility.

If the node is an atom, returns a AtomNodeReadUtil with such atom. Otherwise, it returns a ReadError::ExpectedAtom error.

Example
use sise::sise_expr;

let node = sise_expr!("example");
let node_read_util = sise::NodeReadUtil::new(&node, None);
assert_eq!(node_read_util.as_atom().unwrap().atom(), "example");

If the node is a list, returns a ListNodeReadUtil with such list. Otherwise, it returns a ReadError::ExpectedList error.

Example
use sise::sise_expr;

let node = sise_expr!(["example"]);
let node_read_util = sise::NodeReadUtil::new(&node, None);
assert_eq!(node_read_util.as_list().unwrap().list(), [sise_expr!("example")]);

Trait Implementations§

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. 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

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
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.