#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

#744 in Math

Download history 1897/week @ 2024-11-16 2089/week @ 2024-11-23 2728/week @ 2024-11-30 2190/week @ 2024-12-07 2202/week @ 2024-12-14 1454/week @ 2024-12-21 2112/week @ 2024-12-28 2347/week @ 2025-01-04 3585/week @ 2025-01-11 3908/week @ 2025-01-18 4235/week @ 2025-01-25 4545/week @ 2025-02-01 5559/week @ 2025-02-08 6696/week @ 2025-02-15 6548/week @ 2025-02-22 4589/week @ 2025-03-01

24,223 downloads per month
Used in 72 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