combine::parser::byte

Function space

Source
pub fn space<I>() -> Space<I>
where I: Stream<Item = u8>, I::Error: ParseError<I::Item, I::Range, I::Position>,
Expand description

Parses a b' ', b'\t', b'\n' or 'b\'r'.

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