[][src]Function combine::parser::char::space

pub fn space<Input>() -> impl Parser<Input, Output = char, PartialState = ()> where
    Input: Stream<Token = char>,
    Input::Error: ParseError<Input::Token, Input::Range, Input::Position>, 

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());