| Crates.io | grapheme |
| lib.rs | grapheme |
| version | 1.2.1 |
| created_at | 2025-08-26 10:50:07.968419+00 |
| updated_at | 2025-09-06 18:48:40.08358+00 |
| description | Abstractions for working with extended Unicode grapheme clusters |
| homepage | |
| repository | https://github.com/Hedgehogo/grapheme |
| max_upload_size | |
| id | 1810995 |
| size | 77,041 |
This crate offers types related to extended Unicode grapheme clusters, which
are replacements for the standard types char and str.
char and str types.g! and gs!, used as literals to create crate types, performing
all necessary checks at compile time.Add this to your Cargo.toml:
[dependencies]
grapheme = "1"
Then:
use grapheme::prelude::*;
let alpha = gs!("a 6 y̆ நி र्क");
let mut iter = alpha.iter().filter(|g| g.is_alphabetic());
assert_eq!(Some(g!("a")), iter.next());
assert_eq!(Some(g!("y̆")), iter.next());
assert_eq!(Some(g!("நி")), iter.next());
assert_eq!(Some(g!("र्क")), iter.next());
assert_eq!(None, iter.next());