#class #unicode #math-class

unicode-math-class

Determine the Unicode class of a mathematical character

1 unstable release

0.1.0 Mar 27, 2023

#645 in Math

Download history 2345/week @ 2024-12-11 1761/week @ 2024-12-18 1947/week @ 2024-12-25 1908/week @ 2025-01-01 2873/week @ 2025-01-08 3589/week @ 2025-01-15 4512/week @ 2025-01-22 3936/week @ 2025-01-29 5926/week @ 2025-02-05 4755/week @ 2025-02-12 7996/week @ 2025-02-19 5343/week @ 2025-02-26 6613/week @ 2025-03-05 4548/week @ 2025-03-12 5109/week @ 2025-03-19 6695/week @ 2025-03-26

23,793 downloads per month
Used in 73 crates (4 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