Function unicode_names::name [] [src]

pub fn name(c: char) -> Option<Name>

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 Strings, or be printed, etc.

Example

assert_eq!(unicode_names::name('a').map(|n| n.to_string()),
           Some("LATIN SMALL LETTER A".to_string()));
assert_eq!(unicode_names::name('\u{2605}').map(|n| n.to_string()),
           Some("BLACK STAR".to_string()));
assert_eq!(unicode_names::name('☃').map(|n| n.to_string()),
           Some("SNOWMAN".to_string()));

// control code
assert!(unicode_names::name('\x00').is_none());
// unassigned
assert!(unicode_names::name('\u{10FFFF}').is_none());