Crates.io | icu_uniset |
lib.rs | icu_uniset |
version | 0.5.0 |
source | src |
created_at | 2020-10-15 15:26:27.681454 |
updated_at | 2022-05-10 18:43:42.384942 |
description | API for highly efficient querying of sets of Unicode characters |
homepage | |
repository | https://github.com/unicode-org/icu4x |
max_upload_size | |
id | 300035 |
size | 126,406 |
icu_uniset
is a utility crate of the ICU4X
project.
This API provides necessary functionality for highly efficient querying of sets of Unicode characters.
It is an implementation of the existing ICU4C UnicodeSet API.
ICU4X [UnicodeSet
] is split up into independent levels, with [UnicodeSet
] representing the membership/query API,
and [UnicodeSetBuilder
] representing the builder API. A Properties API
is in future works.
UnicodeSet
UnicodeSets are created from either serialized UnicodeSets
,
represented by inversion lists,
the [UnicodeSetBuilder
], or from the TBA Properties API.
use icu_uniset::{UnicodeSet, UnicodeSetBuilder};
let mut builder = UnicodeSetBuilder::new();
builder.add_range(&('A'..'Z'));
let set: UnicodeSet = builder.build();
assert!(set.contains('A'));
UnicodeSet
Currently, you can check if a character/range of characters exists in the [UnicodeSet
], or iterate through the characters.
use icu_uniset::{UnicodeSet, UnicodeSetBuilder};
let mut builder = UnicodeSetBuilder::new();
builder.add_range(&('A'..'Z'));
let set: UnicodeSet = builder.build();
assert!(set.contains('A'));
assert!(set.contains_range(&('A'..='C')));
assert_eq!(set.iter_chars().next(), Some('A'));
For more information on development, authorship, contributing etc. please visit ICU4X home page
.