Trait chumsky::text::TextParser[][src]

pub trait TextParser<I: Character, O>: Parser<I, O> {
    fn padded(self) -> Padded<Self, I, O>
    where
        Self: Sized
, { ... } }
Expand description

A trait containing text-specific functionality that extends the Parser trait.

Provided methods

Parse a pattern, ignoring any amount of whitespace both before and after the pattern.

The output type of this parser is O, the same as the original parser.

Examples
let ident = text::ident::<_, Simple<char>>().padded();

// A pattern with no whitespace surrounding it is accepted
assert_eq!(ident.parse("hello"), Ok("hello".to_string()));
// A pattern with arbitrary whitespace surrounding it is also accepted
assert_eq!(ident.parse(" \t \n  \t   world  \t  "), Ok("world".to_string()));

Implementors