#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

#675 in Math

Download history 923/week @ 2024-03-27 976/week @ 2024-04-03 865/week @ 2024-04-10 657/week @ 2024-04-17 789/week @ 2024-04-24 906/week @ 2024-05-01 580/week @ 2024-05-08 1723/week @ 2024-05-15 1303/week @ 2024-05-22 917/week @ 2024-05-29 1233/week @ 2024-06-05 1092/week @ 2024-06-12 1111/week @ 2024-06-19 1031/week @ 2024-06-26 1143/week @ 2024-07-03 994/week @ 2024-07-10

4,453 downloads per month
Used in 30 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