#unicode #class #math-class

unicode-math-class

Determine the Unicode class of a mathematical character

1 unstable release

0.1.0 Mar 27, 2023

#652 in Math

Download history 6488/week @ 2025-07-21 8053/week @ 2025-07-28 10016/week @ 2025-08-04 8315/week @ 2025-08-11 7602/week @ 2025-08-18 9981/week @ 2025-08-25 10687/week @ 2025-09-01 12301/week @ 2025-09-08 11576/week @ 2025-09-15 13547/week @ 2025-09-22 12376/week @ 2025-09-29 12217/week @ 2025-10-06 12728/week @ 2025-10-13 13209/week @ 2025-10-20 16593/week @ 2025-10-27 15508/week @ 2025-11-03

58,922 downloads per month
Used in 111 crates (4 directly)

MIT/Apache

85KB
3K SLoC

unicode-math-class

Crates.io Documentation

Determine the Unicode class of a mathematical character in Rust.

[dependencies]
unicode-math-class = "0.1"

Example

use unicode_math_class::{class, MathClass};

assert_eq!(class('0'), Some(MathClass::Normal));
assert_eq!(class('a'), Some(MathClass::Alphabetic));
assert_eq!(class('𝔸'), Some(MathClass::Alphabetic));
assert_eq!(class('+'), Some(MathClass::Vary));
assert_eq!(class('×'), Some(MathClass::Binary));
assert_eq!(class('('), Some(MathClass::Opening));
assert_eq!(class(','), Some(MathClass::Punctuation));
assert_eq!(class('|'), Some(MathClass::Fence));
assert_eq!(class('😃'), None);

For more details, see Section 5.1 of Unicode Technical Report #25 and this data file.

License

This crate is dual-licensed under the MIT and Apache 2.0 licenses.

No runtime deps