Enum control_code::Result
source · pub enum Result<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.
Trait Implementations§
source§impl<'a, I, O, E> GetInput<&'a [I]> for IResult<&'a [I], O, E>
impl<'a, I, O, E> GetInput<&'a [I]> for IResult<&'a [I], O, E>
fn remaining_input(&self) -> Option<&'a [I]>
source§impl<'a, O, E> GetInput<&'a str> for IResult<&'a str, O, E>
impl<'a, O, E> GetInput<&'a str> for IResult<&'a str, O, E>
fn remaining_input(&self) -> Option<&'a str>
source§impl<I, O, E> PartialEq for IResult<I, O, E>
impl<I, O, E> PartialEq for IResult<I, O, E>
impl<I, O, E> Eq for IResult<I, O, E>
impl<I, O, E> StructuralPartialEq for IResult<I, O, E>
Auto Trait Implementations§
impl<I, O, E> Freeze for IResult<I, O, E>
impl<I, O, E> RefUnwindSafe for IResult<I, O, E>
impl<I, O, E> Send for IResult<I, O, E>
impl<I, O, E> Sync for IResult<I, O, E>
impl<I, O, E> Unpin for IResult<I, O, E>
impl<I, O, E> UnwindSafe for IResult<I, O, E>
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit)