Function chomp::combinators::look_ahead
[−]
[src]
pub fn look_ahead<'a, I, T, E, F>(i: Input<'a, I>, f: F) -> ParseResult<'a, I, T, E> where F: FnOnce(Input<'a, I>) -> ParseResult<'a, I, T, E>
Applies the parser F
without consuming any input.
use chomp::{Input, take}; use chomp::combinators::look_ahead; let i = Input::new(b"testing"); let r = look_ahead(i, |i| take(i, 4)).bind(|i, t| take(i, 7).map(|u| (t, u))); assert_eq!(r.unwrap(), (&b"test"[..], &b"testing"[..]));