#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

#665 in Math

Download history 690/week @ 2023-12-15 442/week @ 2023-12-22 616/week @ 2023-12-29 755/week @ 2024-01-05 908/week @ 2024-01-12 1161/week @ 2024-01-19 744/week @ 2024-01-26 662/week @ 2024-02-02 1051/week @ 2024-02-09 975/week @ 2024-02-16 771/week @ 2024-02-23 809/week @ 2024-03-01 1703/week @ 2024-03-08 1972/week @ 2024-03-15 1166/week @ 2024-03-22 815/week @ 2024-03-29

5,819 downloads per month
Used in 20 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