Module icu::collections::codepointinvlist
source · Expand description
This module provides necessary functionality for highly efficient querying of sets of Unicode characters.
It is an implementation of the code point portion of the existing ICU4C UnicodeSet API.
§Architecture
ICU4X CodePointInversionList
is split up into independent levels, with CodePointInversionList
representing the membership/query API,
and CodePointInversionListBuilder
representing the builder API.
§Examples:
§Creating a CodePointInversionList
CodePointSets
are created from either serialized CodePointSets
,
represented by inversion lists,
the CodePointInversionListBuilder
, or from the Properties API.
use icu::collections::codepointinvlist::{
CodePointInversionList, CodePointInversionListBuilder,
};
let mut builder = CodePointInversionListBuilder::new();
builder.add_range('A'..='Z');
let set: CodePointInversionList = builder.build();
assert!(set.contains('A'));
§Querying a CodePointInversionList
Currently, you can check if a character/range of characters exists in the CodePointInversionList
, or iterate through the characters.
use icu::collections::codepointinvlist::{
CodePointInversionList, CodePointInversionListBuilder,
};
let mut builder = CodePointInversionListBuilder::new();
builder.add_range('A'..='Z');
let set: CodePointInversionList = builder.build();
assert!(set.contains('A'));
assert!(set.contains_range('A'..='C'));
assert_eq!(set.iter_chars().next(), Some('A'));
Structs§
- A membership wrapper for
CodePointInversionList
. - A builder for
CodePointInversionList
. - A CodePointInversionList was constructed with an invalid inversion list
- A CodePointInversionList was constructed from an invalid range