#unicode #class

unicode-math-class

Determine the Unicode class of a mathematical character

1 unstable release

0.1.0 Mar 27, 2023

#428 in Math

Download history 910/week @ 2023-06-08 452/week @ 2023-06-15 840/week @ 2023-06-22 1301/week @ 2023-06-29 485/week @ 2023-07-06 513/week @ 2023-07-13 533/week @ 2023-07-20 463/week @ 2023-07-27 886/week @ 2023-08-03 750/week @ 2023-08-10 1028/week @ 2023-08-17 1102/week @ 2023-08-24 553/week @ 2023-08-31 1074/week @ 2023-09-07 1038/week @ 2023-09-14 936/week @ 2023-09-21

3,698 downloads per month

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