Trait flussab::ResultExt[][src]

pub trait ResultExt<T, E> {
    fn err_into<E2: From<E>>(self) -> Result<T, E2>;
fn and_also(self, f: impl FnOnce(&mut T) -> Result<(), E>) -> Self;
fn and_do(self, f: impl FnOnce(&mut T)) -> Self; }

This trait implements additional methods for Result values, which are useful for parsing.

Required methods

fn err_into<E2: From<E>>(self) -> Result<T, E2>[src]

Equivalent to map_err(From::from).

fn and_also(self, f: impl FnOnce(&mut T) -> Result<(), E>) -> Self[src]

Variant of and_then which always returns the (possibly modified) original value on success.

This is useful to parse delimiters which do not contain any parsed information.

fn and_do(self, f: impl FnOnce(&mut T)) -> Self[src]

Variant of and_also where the action cannot fail.

This is useful to modify a value or to perform side-effects on successful parses.

Loading content...

Implementors

impl<T, E> ResultExt<T, E> for Result<T, E>[src]

Loading content...