Trait pipe_chain::pipe::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§
sourcefn opt(self) -> Opt<Self, O>where
Self: Sized,
I: Clone,
O: Unpack,
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,))));