grapheme

Crates.iographeme
lib.rsgrapheme
version1.2.1
created_at2025-08-26 10:50:07.968419+00
updated_at2025-09-06 18:48:40.08358+00
descriptionAbstractions for working with extended Unicode grapheme clusters
homepage
repositoryhttps://github.com/Hedgehogo/grapheme
max_upload_size
id1810995
size77,041
(Hedgehogo)

documentation

README

grapheme

Crates.io Documentation

This crate offers types related to extended Unicode grapheme clusters, which are replacements for the standard types char and str.

Features

  • Replacement for the standard library char and str types.
  • Optimized owning grapheme type.
  • Macros g! and gs!, used as literals to create crate types, performing all necessary checks at compile time.

Usage

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());
Commit count: 38

cargo fmt