#class #unicode #math-class

unicode-math-class

Determine the Unicode class of a mathematical character

1 unstable release

0.1.0 Mar 27, 2023

#633 in Math

Download history 2101/week @ 2024-12-09 2121/week @ 2024-12-16 1811/week @ 2024-12-23 1806/week @ 2024-12-30 2443/week @ 2025-01-06 3559/week @ 2025-01-13 4007/week @ 2025-01-20 4143/week @ 2025-01-27 4762/week @ 2025-02-03 5666/week @ 2025-02-10 7240/week @ 2025-02-17 5906/week @ 2025-02-24 6156/week @ 2025-03-03 5221/week @ 2025-03-10 5562/week @ 2025-03-17 5217/week @ 2025-03-24

22,543 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