Determine the Unicode class of a mathematical character in Rust.
toml
[dependencies]
unicode-math-class = "0.1"
```rust use unicodemathclass::{class, MathClass};
asserteq!(class('0'), Some(MathClass::Normal)); asserteq!(class('a'), Some(MathClass::Alphabetic)); asserteq!(class('𝔸'), Some(MathClass::Alphabetic)); asserteq!(class('+'), Some(MathClass::Vary)); asserteq!(class('×'), Some(MathClass::Binary)); asserteq!(class('('), Some(MathClass::Opening)); asserteq!(class(','), Some(MathClass::Punctuation)); asserteq!(class('|'), Some(MathClass::Fence)); assert_eq!(class('😃'), None); ```
For more details, see Section 5.1 of Unicode Technical Report #25 and this data file.
This crate is dual-licensed under the MIT and Apache 2.0 licenses.