Function parser_compose::any_str

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

A parser that recognizes the first unicode scalar value at the start of a string slice.

A unicode scalar value is not always what you might consider a “character”. This function will output the first thing that rust considers a char.

Errors

An error is reported if the string slice is empty

use parser_compose::{Parser, any_str};

let msg = "👻Boo";

let (value, rest) = any_str(msg).unwrap();

assert_eq!(value, "👻");