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§
Sourcefn unpack(self) -> UnpackPipe<Self, O>
fn unpack(self) -> UnpackPipe<Self, O>
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")));