Crates.io | unicode_names |
lib.rs | unicode_names |
version | 0.1.7 |
source | src |
created_at | 2014-11-14 08:25:07.671462 |
updated_at | 2015-12-11 23:59:34.806356 |
description | Map characters to and from their name given in the Unicode standard. This goes to great lengths to be as efficient as possible in both time and space, with the full bidirectional tables weighing barely 500 KB but still offering O(1)* look-up in both directions. (*more precisely, O(length of name).) |
homepage | https://github.com/huonw/unicode_names |
repository | https://github.com/huonw/unicode_names |
max_upload_size | |
id | 96 |
size | 1,642,509 |
Time and memory efficiently mapping characters to and from their Unicode 7.0 names, at runtime and compile-time.
extern crate unicode_names;
fn main() {
println!("☃ is called {}", unicode_names::name('☃')); // SNOWMAN
println!("{} is happy", unicode_names::character("white smiling face")); // ☺
// (NB. case insensitivity)
}
The maps are compressed using similar tricks to Python's unicodedata
module, although those here are about 70KB (12%) smaller.