UnpackExt

Trait UnpackExt 

Source
pub trait UnpackExt<I, O, E, R> {
    // Provided method
    fn unpack(self) -> UnpackPipe<Self, O>
       where O: Unpack,
             Self: Sized { ... }
}
Expand description

Combinator that calls tuplify::Unpack::unpack on it’s output

Provided Methods§

Source

fn unpack(self) -> UnpackPipe<Self, O>
where O: Unpack, Self: Sized,

Unpacks the output of a pipe

Example:

// unpacking many elements does nothing
assert_eq!(
    tag::<Error, _, _>("foo").and(tag("bar")).unpack().apply("foobar"),
    Ok(("", ("foo", "bar")))
);

// single element without unpacking
assert_eq!(tag::<Error, _, _>("foo").apply("foo"), Ok(("", ("foo",))));

// single element with unpacking
assert_eq!(tag::<Error, _, _>("foo").unpack().apply("foo"), Ok(("", "foo")));

Implementors§

Source§

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