Expand description
Unicode character composition and decomposition utilities as described in Unicode Standard Annex #15.
extern crate unicode_normalization;
use unicode_normalization::char::compose;
use unicode_normalization::UnicodeNormalization;
fn main() {
assert_eq!(compose('A','\u{30a}'), Some('Å'));
let s = "ÅΩ";
let c = s.nfc().collect::<String>();
assert_eq!(c, "ÅΩ");
}
§crates.io
You can use this package in your project by adding the following
to your Cargo.toml
:
[dependencies]
unicode-normalization = "0.1.20"
Modules§
- char
- Methods for composing and decomposing characters.
Structs§
- Decompositions
- External iterator for a string decomposition’s characters.
- Recompositions
- External iterator for a string recomposition’s characters.
- Replacements
- External iterator for replacements for a string’s characters.
- Stream
Safe - UAX15-D4: This iterator keeps track of how many non-starters there have been since the last starter in NFKD and will emit a Combining Grapheme Joiner (U+034F) if the count exceeds 30.
Enums§
- IsNormalized
- QuickCheck quickly determines if a string is normalized, it can return
Maybe
Constants§
Traits§
- Unicode
Normalization - Methods for iterating over strings while applying Unicode normalizations as described in Unicode Standard Annex #15.
Functions§
- is_nfc
- Authoritatively check if a string is in NFC.
- is_
nfc_ quick - Quickly check if a string is in NFC, potentially returning
IsNormalized::Maybe
if further checks are necessary. In this case a check likes.chars().nfc().eq(s.chars())
should suffice. - is_
nfc_ stream_ safe - Authoritatively check if a string is Stream-Safe NFC.
- is_
nfc_ stream_ safe_ quick - Quickly check if a string is Stream-Safe NFC.
- is_nfd
- Authoritatively check if a string is in NFD.
- is_
nfd_ quick - Quickly check if a string is in NFD.
- is_
nfd_ stream_ safe - Authoritatively check if a string is Stream-Safe NFD.
- is_
nfd_ stream_ safe_ quick - Quickly check if a string is Stream-Safe NFD.
- is_nfkc
- Authoritatively check if a string is in NFKC.
- is_
nfkc_ quick - Quickly check if a string is in NFKC.
- is_nfkd
- Authoritatively check if a string is in NFKD.
- is_
nfkd_ quick - Quickly check if a string is in NFKD.