Function combine::parser::byte::byte

source ·
pub fn byte<Input>(c: u8) -> Token<Input>
where Input: Stream<Token = u8>,
Expand description

Parses a byte and succeeds if the byte is equal to c.

use combine::Parser;
use combine::parser::byte::byte;
assert_eq!(byte(b'!').parse(&b"!"[..]), Ok((b'!', &b""[..])));
assert!(byte(b'A').parse(&b""[..]).is_err());
assert!(byte(b'A').parse(&b"!"[..]).is_err());