#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

#799 in Development tools

Download history 1186/week @ 2024-01-01 2177/week @ 2024-01-08 1575/week @ 2024-01-15 1560/week @ 2024-01-22 1486/week @ 2024-01-29 1851/week @ 2024-02-05 1945/week @ 2024-02-12 1706/week @ 2024-02-19 2394/week @ 2024-02-26 3533/week @ 2024-03-04 3046/week @ 2024-03-11 2550/week @ 2024-03-18 1700/week @ 2024-03-25 2861/week @ 2024-04-01 4047/week @ 2024-04-08 3278/week @ 2024-04-15

12,096 downloads per month
Used in 25 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.5–0.8MB
~14K SLoC