Function unicode_names2::name
source · [−]Expand description
Find the name of c
, or None
if c
has no name.
The return value is an iterator that yields &str
components of
the name successively (including spaces and hyphens). It
implements Show
, and thus can be used naturally to build
String
s, or be printed, etc.
Example
assert_eq!(unicode_names2::name('a').map(|n| n.to_string()),
Some("LATIN SMALL LETTER A".to_string()));
assert_eq!(unicode_names2::name('\u{2605}').map(|n| n.to_string()),
Some("BLACK STAR".to_string()));
assert_eq!(unicode_names2::name('☃').map(|n| n.to_string()),
Some("SNOWMAN".to_string()));
// control code
assert!(unicode_names2::name('\x00').is_none());
// unassigned
assert!(unicode_names2::name('\u{10FFFF}').is_none());