Function combine::parser::char::space

source ·
pub fn space<Input>() -> impl Parser<Input, Output = char, PartialState = ()>
where Input: Stream<Token = char>,
Expand description

Parse a single whitespace according to std::char::is_whitespace.

This includes space characters, tabs and newlines.

use combine::Parser;
use combine::parser::char::space;
assert_eq!(space().parse(" "), Ok((' ', "")));
assert_eq!(space().parse("  "), Ok((' ', " ")));
assert!(space().parse("!").is_err());
assert!(space().parse("").is_err());