Function parser_compose::first_utf8_scalar
source · pub fn first_utf8_scalar(input: &str) -> Option<(&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
.
use parser_compose::{Parser, first_utf8_scalar};
let msg = "👻Boo";
let (value, rest) = first_utf8_scalar(msg).unwrap();
assert_eq!(value, "👻");