[−][src]Enum sise::NodeReadUtil
Utility to read nodes from a Reader
.
Variants
Atom(AtomReadUtil<R>)
List(ListReadUtil<'a, R>)
Methods
impl<'a, R: Reader> NodeReadUtil<'a, R>
[src]
pub fn new(reader: &'a mut R) -> Result<Self, R::Error>
[src]
Reads from reader
and builds a ReadUtil::Atom
or
ReadUtil::List
according to the result. Panics if the
reader returns ReadItemKind::ListEnding
.
pub fn expect_atom(
self
) -> Result<AtomReadUtil<R>, ReadUtilError<R::Error, R::Pos>>
[src]
self
) -> Result<AtomReadUtil<R>, ReadUtilError<R::Error, R::Pos>>
Consumes self
and returns an AtomReadUtil
if it is an atom,
otherwise it returns a ReadUtilError::ExpectedAtom
.
Example
let src_data = b"example"; let mut parser = sise::Parser::new(src_data); let mut node_read_util = sise::NodeReadUtil::new(&mut parser).unwrap(); let atom_read_util = node_read_util.expect_atom().unwrap(); assert_eq!(atom_read_util.into_atom(), "example");
pub fn expect_list(
self
) -> Result<ListReadUtil<'a, R>, ReadUtilError<R::Error, R::Pos>>
[src]
self
) -> Result<ListReadUtil<'a, R>, ReadUtilError<R::Error, R::Pos>>
Consumes self
and returns an AtomReadUtil
if it is a list,
otherwise it returns a ReadUtilError::ExpectedListBeginning
.
Example
let src_data = b"()"; let mut parser = sise::Parser::new(src_data); let node_read_util = sise::NodeReadUtil::new(&mut parser).unwrap(); let mut list_read_util = node_read_util.expect_list().unwrap();
Auto Trait Implementations
impl<'a, R> Send for NodeReadUtil<'a, R> where
R: Send,
<R as Reader>::Pos: Send,
<R as Reader>::String: Send,
R: Send,
<R as Reader>::Pos: Send,
<R as Reader>::String: Send,
impl<'a, R> Sync for NodeReadUtil<'a, R> where
R: Sync,
<R as Reader>::Pos: Sync,
<R as Reader>::String: Sync,
R: Sync,
<R as Reader>::Pos: Sync,
<R as Reader>::String: Sync,
impl<'a, R> Unpin for NodeReadUtil<'a, R> where
<R as Reader>::Pos: Unpin,
<R as Reader>::String: Unpin,
<R as Reader>::Pos: Unpin,
<R as Reader>::String: Unpin,
impl<'a, R> !UnwindSafe for NodeReadUtil<'a, R>
impl<'a, R> RefUnwindSafe for NodeReadUtil<'a, R> where
R: RefUnwindSafe,
<R as Reader>::Pos: RefUnwindSafe,
<R as Reader>::String: RefUnwindSafe,
R: RefUnwindSafe,
<R as Reader>::Pos: RefUnwindSafe,
<R as Reader>::String: RefUnwindSafe,
Blanket Implementations
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = !
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,