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

#1076 in Procedural macros

36 downloads per month
Used in unicode_names2

MIT/Apache

305KB
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 15.1 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.6–4MB
~75K SLoC