BoxedExt

Trait BoxedExt 

Source
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 { ... }
}
Expand description

Wrap a Pipe into a Box

Provided Methods§

Source

fn boxed<'a>(self) -> BoxedPipe<'a, I, O, E, R>
where Self: Pipe<I, O, E, R> + Sized + 'a,

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"))));

Implementors§

Source§

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