Function chomp::combinators::look_ahead [] [src]

pub fn look_ahead<I: Input, T, E, F>(i: I, f: F) -> ParseResult<I, T, E> where
    F: FnOnce(I) -> ParseResult<I, T, E>, 

Applies the parser F without consuming any input.

use chomp::prelude::{parse_only, take};
use chomp::combinators::look_ahead;

let p = |i| look_ahead(i, |i| take(i, 4)).bind(|i, t| take(i, 7).map(|u| (t, u)));

assert_eq!(parse_only(p, b"testing"), Ok((&b"test"[..], &b"testing"[..])));