Type Definition nom::IResult

source ·
pub type IResult<I, O, E = Error<I>> = Result<(I, O), Err<E>>;
Expand description

Holds the result of parsing functions

It depends on the input type I, the output type O, and the error type E (by default (I, nom::ErrorKind))

The Ok side is a pair containing the remainder of the input (the part of the data that was not parsed) and the produced value. The Err side contains an instance of nom::Err.

Outside of the parsing code, you can use the Finish::finish method to convert it to a more common result type

Trait Implementations§

source§

impl<I, O, E> Finish<I, O, E> for IResult<I, O, E>

source§

fn finish(self) -> Result<(I, O), E>

converts the parser’s result to a type that is more consumable by error management libraries. It keeps the same Ok branch, and merges Err::Error and Err::Failure into the Err side. Read more