#class #unicode #character #determine #math-class

unicode-math-class

Determine the Unicode class of a mathematical character

1 unstable release

0.1.0 Mar 27, 2023

#696 in Math

Download history 1023/week @ 2024-08-12 1345/week @ 2024-08-19 1325/week @ 2024-08-26 1317/week @ 2024-09-02 1240/week @ 2024-09-09 1360/week @ 2024-09-16 1757/week @ 2024-09-23 1456/week @ 2024-09-30 1504/week @ 2024-10-07 2213/week @ 2024-10-14 2046/week @ 2024-10-21 1852/week @ 2024-10-28 1788/week @ 2024-11-04 1994/week @ 2024-11-11 1902/week @ 2024-11-18 2408/week @ 2024-11-25

8,306 downloads per month
Used in 44 crates (2 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