pub enum IResult<I, O, E = u32> {
Done(I, O),
Error(ErrorKind<E>),
Incomplete(Needed),
}
Expand description
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
Implementations§
Source§impl<I, O, E> IResult<I, O, E>
impl<I, O, E> IResult<I, O, E>
Sourcepub fn map_err<N, F>(self, f: F) -> IResult<I, O, N>
pub fn map_err<N, F>(self, f: F) -> IResult<I, O, 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.
Sourcepub fn unwrap_err(self) -> ErrorKind<E>
pub fn unwrap_err(self) -> ErrorKind<E>
Unwrap the contained Error(E)
value, or panic if the IResult
is not
Error
.
Sourcepub fn to_full_result(self) -> Result<O, IError<E>>
pub fn to_full_result(self) -> Result<O, IError<E>>
Convert the IResult to a std::result::Result
Source§impl<I, O, E> IResult<I, O, E>
impl<I, O, E> IResult<I, O, E>
pub fn is_done(&self) -> bool
pub fn is_err(&self) -> bool
pub fn is_incomplete(&self) -> bool
pub fn or(self, other: IResult<I, O, E>) -> IResult<I, O, E>
Sourcepub fn map<N, F>(self, f: F) -> IResult<I, N, E>where
F: FnOnce(O) -> N,
pub fn map<N, F>(self, f: F) -> IResult<I, N, E>where
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.
Sourcepub fn map_inc<F>(self, f: F) -> IResult<I, O, E>
pub fn map_inc<F>(self, f: F) -> IResult<I, O, E>
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.
Sourcepub fn unwrap(self) -> (I, O)
pub fn unwrap(self) -> (I, O)
Unwrap the contained Done(I, O)
value, or panic if the IResult
is not
Done
.
Sourcepub fn unwrap_inc(self) -> Needed
pub fn unwrap_inc(self) -> Needed
Unwrap the contained Incomplete(n)
value, or panic if the IResult
is not
Incomplete
.