pub fn string<P: Parser>(parser: P) -> StringParser<P>
Expand description
Parse using parser
, but instead of converting the matched text to a
Rust value, simply return it as a String
.
By default, parser!(alpha+)
returns a Vec<char>
, and sometimes that
is handy in AoC, but often it’s better to have it return a String
.
That can be done with parser!(string(alpha+))
.