6 releases (2 stable)

1.1.0 Oct 2, 2023
1.0.0 Aug 13, 2023
0.6.0 Oct 13, 2022
0.4.0 Mar 17, 2020
0.2.0 Jun 17, 2018

#92 in #unicode-text


Used in unicode_names2

MIT/Apache

335KB
1K SLoC

Rust 810 SLoC // 0.1% comments Python 191 SLoC // 0.0% comments

unicode_names2

Build Status

Time and memory efficiently mapping characters to and from their Unicode 16.0 names, at runtime and compile-time.

fn main() {
    println!("☃ is called {}", unicode_names2::name('')); // SNOWMAN
    println!("{} is happy", unicode_names2::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.

Documentation


lib.rs:

A macro that maps unicode names to chars and strings.

Dependencies

~2.4–4MB
~75K SLoC