pub trait BoxedExt<I, O, E, R = I> {
// Provided method
fn boxed<'a>(self) -> BoxedPipe<'a, I, O, E, R>
where Self: Pipe<I, O, E, R> + Sized + 'a { ... }
}Provided Methods§
Sourcefn boxed<'a>(self) -> BoxedPipe<'a, I, O, E, R>
fn boxed<'a>(self) -> BoxedPipe<'a, I, O, E, R>
Wraps the current Pipe into a Box
example:
fn mk_pipe<'a>() -> BoxedPipe<'a, &'a str, (&'a str, &'a str), Error> {
tag::<Error, _, _>("1").and(tag("2")).boxed()
}
fn mk_pipe2<'a>() -> BoxedPipe<'a, &'a str, (&'a str, &'a str), Error> {
tag::<Error, _, _>("1").and(tag("2")).and_self(tag("3")).boxed()
}
let mut v = vec![mk_pipe(), mk_pipe2()];
assert_eq!(v[0].apply("123"), Ok(("3", ("1", "2"))));
assert_eq!(v[1].apply("123"), Ok(("", ("1", "2"))));