Function parser_compose::any_char

source ·
pub fn any_char(input: &str) -> Res<&str, char, ()>
Expand description

A parser that matches the first char at the start of the string slice.

The same PSAs for char apply. A unicode scalar value is not always what you might consider a “character”.

Errors

An error is reported if the string slice is empty

use parser_compose::{Parser,any_char};

let msg = "👻Boo";

let (value, rest) = any_char.try_parse(msg).unwrap();

assert_eq!(value, '👻');