icu_collections/codepointtrie/mod.rs
1// This file is part of ICU4X. For terms of use, please see the file
2// called LICENSE at the top level of the ICU4X source tree
3// (online at: https://github.com/unicode-org/icu4x/blob/main/LICENSE ).
4
5//! This module provides a data structure for an time-efficient lookup of values
6//! associated to code points.
7//!
8//! It is an implementation of the existing [ICU4C UCPTrie](https://unicode-org.github.io/icu-docs/apidoc/released/icu4c/ucptrie_8h.html)
9//! / [ICU4J CodePointTrie](https://unicode-org.github.io/icu-docs/apidoc/dev/icu4j/) API.
10//!
11//! # Architecture
12//!
13//! ICU4X [`CodePointTrie`] is designed to provide a read-only view of [`CodePointTrie`] data that is exported
14//! from ICU4C. Detailed information about the design of the data structure can be found in the documentation
15//! for the [`CodePointTrie`] struct.
16//!
17//! # Examples
18//!
19//! ## Querying a `CodePointTrie`
20//!
21//! ```
22//! use icu::collections::codepointtrie::planes;
23//! let trie = planes::get_planes_trie();
24//!
25//! assert_eq!(0, trie.get32(0x41)); // 'A' as u32
26//! assert_eq!(0, trie.get32(0x13E0)); // 'Ꮰ' as u32
27//! assert_eq!(1, trie.get32(0x10044)); // '𐁄' as u32
28//! ```
29//!
30//! [`ICU4X`]: ../icu/index.html
31
32mod cptrie;
33mod error;
34mod impl_const;
35mod iter;
36pub mod planes;
37
38#[cfg(feature = "serde")]
39pub mod toml;
40
41#[cfg(feature = "serde")]
42mod serde;
43
44pub use cptrie::AbstractCodePointTrie;
45pub use cptrie::CodePointMapRange;
46pub use cptrie::CodePointMapRangeIterator;
47pub use cptrie::CodePointTrie;
48pub use cptrie::CodePointTrieHeader;
49pub use cptrie::FastCodePointTrie;
50pub use cptrie::SmallCodePointTrie;
51pub use cptrie::TrieType;
52pub use cptrie::TrieValue;
53pub use cptrie::Typed;
54pub use cptrie::TypedCodePointTrie;
55pub use error::Error as CodePointTrieError;
56pub use iter::CharIndicesWithTrie;
57pub use iter::CharIndicesWithTrieDefaultForAscii;
58pub use iter::CharIterWithTrie;
59pub use iter::CharsWithTrie;
60pub use iter::CharsWithTrieDefaultForAscii;
61pub use iter::CharsWithTrieDefaultForAsciiEx;
62pub use iter::CharsWithTrieEx;
63pub use iter::Latin1CharIndicesWithTrie;
64pub use iter::Latin1CharsWithTrie;
65pub use iter::Latin1CharsWithTrieEx;
66pub use iter::WithTrie;