Enum nom_operator::IResult
[−]
[src]
pub enum IResult<I, O, E = u32> { Done(I, O), Error(ErrorKind<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)
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(ErrorKind<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(ErrorKind<E>) -> ErrorKind<N>,
F: FnOnce(ErrorKind<E>) -> ErrorKind<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) -> ErrorKind<E>
Unwrap the contained Error(E)
value, or panic if the IResult
is not
Error
.
fn to_full_result(self) -> Result<O, IError<E>>
Convert the IResult to a std::result::Result
fn to_result(self) -> Result<O, ErrorKind<E>>
Convert the IResult to a std::result::Result, or panic if the IResult
is Incomplete
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 or(self, other: IResult<I, O, E>) -> IResult<I, O, E>
fn map<N, F>(self, f: F) -> IResult<I, N, E> where
F: FnOnce(O) -> N,
F: FnOnce(O) -> N,
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,
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_or(self, default: (I, O)) -> (I, O)
Unwrap the contained Done(I, O)
value or a default 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<'a, I, O, E> GetInput<&'a [I]> for IResult<&'a [I], O, E>
[src]
fn remaining_input(&self) -> Option<&'a [I]>
impl<O, E> GetInput<()> for IResult<(), O, E>
[src]
fn remaining_input(&self) -> Option<()>
impl<'a, O, E> GetInput<&'a str> for IResult<&'a str, O, E>
[src]
fn remaining_input(&self) -> Option<&'a str>
impl<I, O, E> Eq for IResult<I, O, E> where
E: Eq,
I: Eq,
O: Eq,
[src]
E: Eq,
I: Eq,
O: Eq,
impl<I, O, E> PartialEq<IResult<I, O, E>> for IResult<I, O, E> where
E: PartialEq<E>,
I: PartialEq<I>,
O: PartialEq<O>,
[src]
E: PartialEq<E>,
I: PartialEq<I>,
O: PartialEq<O>,
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<'a, I, O, E> GetOutput<&'a [O]> for IResult<I, &'a [O], E>
[src]
impl<'a, I, E> GetOutput<&'a str> for IResult<I, &'a str, E>
[src]
impl<I, E> GetOutput<()> for IResult<I, (), E>
[src]
impl<I, O, E> Debug for IResult<I, O, E> where
E: Debug,
I: Debug,
O: Debug,
[src]
E: Debug,
I: Debug,
O: Debug,
fn fmt(&self, __arg_0: &mut Formatter) -> Result<(), Error>
Formats the value using the given formatter.
impl<I, O, E> Clone for IResult<I, O, E> where
E: Clone,
I: Clone,
O: Clone,
[src]
E: Clone,
I: Clone,
O: Clone,
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