Enum nom::IResult
[−]
[src]
pub enum IResult<I, O, E = u32> {
Done(I, O),
Error(Err<I, E>),
Incomplete(Needed),
}Holds the result of parsing functions
It depends on I, the input type, O, the output type, and E, the error type (by default u32)
Depending on a compilation flag, the content of the Error variant
can change. By default, it will be a ErrorKind<E=u32> (with E configurable).
If you activate the verbose-errors compilation flags, it will be an
enum that contains an error code, optionally, an input position,
and an error sent by child parsers.
The verbose errors feature allows very flexible error management: you can know precisely which parser got to which part of the input. The main drawback is that it is a lot slower than default error management.
Variants
Done(I, O)indicates a correct parsing, the first field containing the rest of the unparsed data, the second field contains the parsed data
Error(Err<I, E>)contains a Err, an enum that can indicate an error code, a position in the input, and a pointer to another error, making a list of errors in the parsing tree
Incomplete(Needed)Incomplete contains a Needed, an enum than can represent a known quantity of input data, or unknown
Methods
impl<I, O, E> IResult<I, O, E>[src]
fn map_err<N, F>(self, f: F) -> IResult<I, O, N> where F: FnOnce(Err<I, E>) -> Err<I, N>
Maps a IResult<I, O, E> to IResult<I, O, N> by appling a function
to a contained Error value, leaving Done and Incomplete value
untouched.
fn unwrap_err(self) -> Err<I, E>
Unwrap the contained Error(I, E) value, or panic if the IResult is not
Error.
fn to_full_result(self) -> Result<O, IError<I, E>>
Convert the IResult to a std::result::Result
fn to_result(self) -> Result<O, Err<I, E>>
Convert the IResult to a std::result::Result
impl<I, O, E> IResult<I, O, E>[src]
fn is_done(&self) -> bool
fn is_err(&self) -> bool
fn is_incomplete(&self) -> bool
fn map<N, F: FnOnce(O) -> N>(self, f: F) -> IResult<I, N, E>
Maps a IResult<I, O, E> to IResult<I, N, E> by appling a function
to a contained Done value, leaving Error and Incomplete value
untouched.
fn map_inc<F>(self, f: F) -> IResult<I, O, E> where F: FnOnce(Needed) -> Needed
Maps a IResult<I, O, E> to IResult<I, O, E> by appling a function
to a contained Incomplete value, leaving Done and Error value
untouched.
fn unwrap(self) -> (I, O)
Unwrap the contained Done(I, O) value, or panic if the IResult is not
Done.
fn unwrap_inc(self) -> Needed
Unwrap the contained Incomplete(n) value, or panic if the IResult is not
Incomplete.
Trait Implementations
impl<I: Debug, O: Debug, E: Debug> Debug for IResult<I, O, E>[src]
impl<I: PartialEq, O: PartialEq, E: PartialEq> PartialEq for IResult<I, O, E>[src]
fn eq(&self, __arg_0: &IResult<I, O, E>) -> bool
This method tests for self and other values to be equal, and is used by ==. Read more
fn ne(&self, __arg_0: &IResult<I, O, E>) -> bool
This method tests for !=.
impl<I: Eq, O: Eq, E: Eq> Eq for IResult<I, O, E>[src]
impl<I: Clone, O: Clone, E: Clone> Clone for IResult<I, O, E>[src]
fn clone(&self) -> IResult<I, O, E>
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)1.0.0
Performs copy-assignment from source. Read more