Expand description
§grapheme
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
charandstrtypes. - Optimized owning grapheme type.
- Macros
g!andgs!, 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());Re-exports§
pub use grapheme::Grapheme;pub use grapheme_owned::GraphemeOwned;pub use grapheme_owned::MaybeGraphemeOwned;pub use graphemes::Graphemes;
Modules§
- grapheme
- Utilities for the
Graphemetype. - grapheme_
owned - Utilities for the
GraphemeOwnedtype. - graphemes
- Utilities for the
Graphemestype. - prelude
- Commonly used functions, traits and types.