Expand description
§japanese-codepoints
A Rust library for validating and working with Japanese character code points based on JIS standards.
§Character sets
| Feature | Module | Description |
|---|---|---|
| (default) | — | ASCII control / printable via CodePoints |
codepoints-jisx0201 | [jisx0201] | Latin letters and halfwidth katakana |
codepoints-jisx0208 | [jisx0208] | Hiragana, katakana, Latin, Greek, Cyrillic, symbols |
codepoints-jisx0208kanji | [jisx0208kanji] | 6 355 kanji (JIS X 0208 Level 1 & 2) |
codepoints-jisx0213kanji | [jisx0213kanji] | 10 050 kanji (JIS X 0213 Level 1–4) |
full | — | All of the above |
§Quick start
use japanese_codepoints::CodePoints;
let allowed = CodePoints::new(vec![0x3041, 0x3042]); // ぁ, あ
assert!(allowed.contains("あ"));
assert!(!allowed.contains("う"));§Multi-set validation
Use contains_all_in_any to check whether every character in a string
belongs to at least one of several character sets:
use japanese_codepoints::{CodePoints, contains_all_in_any};
let hiragana = CodePoints::new(vec![0x3042, 0x3044]); // あ, い
let katakana = CodePoints::new(vec![0x30A2, 0x30A4]); // ア, イ
assert!(contains_all_in_any("あア", &[&hiragana, &katakana]));For a version that returns a structured error, see
validation::validate_all_in_any.
Re-exports§
pub use codepoints::contains_all_in_any;pub use codepoints::CodePoints;pub use validation::ValidationError;
Modules§
- codepoints
- Core code-point collection type and multi-set membership helper.
- data
- Data modules for character code points
- validation
- Validation utilities for code-point collections.
Macros§
- validate_
codepoints - Validates that
$valuecontains only code points present in$codepoints. - validate_
codepoints_ advanced - Extended validation with additional patterns.