OptExt

Trait OptExt 

Source
pub trait OptExt<I, O, E> {
    // Provided method
    fn opt(self) -> Opt<Self, O>
       where Self: Sized,
             I: Clone,
             O: Unpack { ... }
}
Expand description

Makes a Pipe optional

Provided Methods§

Source

fn opt(self) -> Opt<Self, O>
where Self: Sized, I: Clone, O: Unpack,

Makes a Pipe optional if it returns a non fatal error

example:

assert_eq!(
    tag::<Error, _, _>("foo").opt().apply("foobar"),
    Ok(("bar", (Some("foo"),)))
);

assert_eq!(tag::<Error, _, _>("boo").opt().apply("foobar"), Ok(("foobar", (None,))));

Implementors§

Source§

impl<I, O, E, P> OptExt<I, O, E> for P
where P: Pipe<I, O, E>,