This crate provides a method and Extension Trait on top of the char
type
for returning a corresponding Unicode General Category as defined in the
latest standard.
For now the crate can be included by branch or by tag via git.
#[dependencies]
unicode-categories = { git = "https://github.com/ncatelli/unicode-categories.git", branch = "main" }
Using the char
type extension trait.
use unicode_categories::*;
assert_eq!(Some(Category::Lu), 'A'.unicode_category());
assert_eq!(Some(Category::Ll), 'a'.unicode_category());
Using the included conversion method:
use unicode_categories::*;
assert_eq!(Some(Category::Lu), unicode_category_from_char('A'));
assert_eq!(Some(Category::Ll), unicode_category_from_char('a'));