#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

#1628 in Text processing

Download history 16559/week @ 2024-10-11 16439/week @ 2024-10-18 14719/week @ 2024-10-25 10278/week @ 2024-11-01 22497/week @ 2024-11-08 42796/week @ 2024-11-15 13297/week @ 2024-11-22 22311/week @ 2024-11-29 25115/week @ 2024-12-06 28221/week @ 2024-12-13 5490/week @ 2024-12-20 5807/week @ 2024-12-27 23577/week @ 2025-01-03 33342/week @ 2025-01-10 20036/week @ 2025-01-17 15119/week @ 2025-01-24

94,725 downloads per month
Used in 44 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