pub fn is_xid(s: &str) -> boolExpand description
Returns true if s is a well-formed Unicode identifier under the default
UAX #31 profile: it is non-empty, its first scalar is is_xid_start,
and every remaining scalar is is_xid_continue.
This is a convenience over iterating the scalars by hand. It applies no
language-specific extensions — notably it rejects a leading underscore, so
callers whose grammar allows _name should test that case themselves.
§Examples
use unicode_lang::is_xid;
assert!(is_xid("total"));
assert!(is_xid("Δpressure"));
assert!(is_xid("café"));
assert!(!is_xid("")); // empty is not an identifier
assert!(!is_xid("1st")); // cannot start with a digit
assert!(!is_xid("a b")); // no interior whitespace
assert!(!is_xid("_name")); // underscore is not XID; opt in separately