#unicode #unicode-characters #name #perfect-hash #run-time #compile-time #generate

build unicode_names2_generator

Generates the perfect-hash function used by unicode_names2

5 stable releases

1.2.2 Mar 10, 2024
1.2.1 Dec 14, 2023
1.2.0 Oct 14, 2023
1.1.0 Oct 2, 2023
1.0.0 Aug 13, 2023

#825 in Development tools

Download history 2705/week @ 2024-03-31 4019/week @ 2024-04-07 3303/week @ 2024-04-14 2999/week @ 2024-04-21 3195/week @ 2024-04-28 2415/week @ 2024-05-05 2462/week @ 2024-05-12 8956/week @ 2024-05-19 9224/week @ 2024-05-26 9212/week @ 2024-06-02 15788/week @ 2024-06-09 8732/week @ 2024-06-16 12369/week @ 2024-06-23 9793/week @ 2024-06-30 10080/week @ 2024-07-07 6509/week @ 2024-07-14

39,236 downloads per month
Used in 28 crates (via unicode_names2)

MIT/Apache

30KB
651 lines

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

Dependencies

~0.8–1.1MB
~14K SLoC