Crates.io | unicode-math-class |
lib.rs | unicode-math-class |
version | 0.1.0 |
source | src |
created_at | 2023-03-27 09:19:06.002385 |
updated_at | 2023-03-27 09:19:06.002385 |
description | Determine the Unicode class of a mathematical character. |
homepage | |
repository | https://github.com/typst/unicode-math-class |
max_upload_size | |
id | 821963 |
size | 95,162 |
Determine the Unicode class of a mathematical character in Rust.
[dependencies]
unicode-math-class = "0.1"
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.
This crate is dual-licensed under the MIT and Apache 2.0 licenses.