PeekExt

Trait PeekExt 

Source
pub trait PeekExt<I, O, E, R> {
    // Provided method
    fn peek(self) -> Peek<Self, R>
       where Self: Sized,
             I: Clone { ... }
}
Expand description

Applies a Pipe without consuming the input

Provided Methods§

Source

fn peek(self) -> Peek<Self, R>
where Self: Sized, I: Clone,

Makes a Pipe optional if it returns a non fatal error

example:

assert_eq!(
   tag::<Error, _, _>("foo").peek().apply("foobar"),
   Ok(("foobar", ("foo",)))
);

assert_eq!(
   tag::<Error, _, _>("boo").peek().apply("foobar"),
   Err(FatalError::Error(Error::Tag(TagStrError("boo".into(), "foo".into()))))
);

Implementors§

Source§

impl<I: Clone, O, E, R, P: Pipe<I, O, E, R>> PeekExt<I, O, E, R> for P