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

#1101 in Procedural macros

Download history 3/week @ 2024-02-19 11/week @ 2024-02-26 1/week @ 2024-03-04 17/week @ 2024-03-11 7/week @ 2024-03-18 52/week @ 2024-04-01 118/week @ 2024-04-15

171 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.5–4MB
~74K SLoC