Struct sise::AtomNodeReadUtil

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

Utility to read atom nodes.

Implementations§

Returns the atom value in this utility.

Returns the position of the atom in this utility.

Decodes the atom using an user-provided function.

The function shall return None if the decodification fails. In such case, ReadError::InvalidValue will be returned, with the value of value_type.

Example
use sise::sise_expr;

let node = sise_expr!("example");
let node_read_util = sise::NodeReadUtil::new(&node, None);
let atom_read_util = node_read_util.as_atom().unwrap();
let decoded = atom_read_util.decode(|atom| Some(atom.len()), "decode_as_atom").unwrap();
assert_eq!(decoded, 7);

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.