Function chomp::parsers::peek [] [src]

pub fn peek<I: Copy>(i: Input<I>) -> SimpleResult<I, Option<I>>

Matches any item but does not consume it, on success it gives Some but if no input remains None is produced.

This parser is never considered incomplete.

use chomp::{Input, peek};

let p1 = Input::new(b"abc");

assert_eq!(peek(p1).unwrap(), Some(b'a'));

let p2 = Input::new(b"");

assert_eq!(peek(p2).unwrap(), None);