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

build unicode_names2_generator

Generates the perfect-hash function used by unicode_names2

6 stable releases

1.3.0 Sep 12, 2024
1.2.2 Mar 10, 2024
1.2.1 Dec 14, 2023
1.2.0 Oct 14, 2023
1.0.0 Aug 13, 2023

#844 in Text processing

Download history 13743/week @ 2024-08-17 18529/week @ 2024-08-24 11512/week @ 2024-08-31 15034/week @ 2024-09-07 13187/week @ 2024-09-14 15007/week @ 2024-09-21 21708/week @ 2024-09-28 8424/week @ 2024-10-05 19620/week @ 2024-10-12 13997/week @ 2024-10-19 17263/week @ 2024-10-26 7540/week @ 2024-11-02 29623/week @ 2024-11-09 36536/week @ 2024-11-16 11753/week @ 2024-11-23 25368/week @ 2024-11-30

106,006 downloads per month
Used in 41 crates (via unicode_names2)

MIT/Apache

30KB
651 lines

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

Dependencies

~2MB
~33K SLoC