• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 
32 extern crate alloc;
33 
34 mod cptrie;
35 mod error;
36 mod impl_const;
37 pub mod planes;
38 
39 #[cfg(feature = "serde")]
40 pub mod toml;
41 
42 #[cfg(feature = "serde")]
43 mod serde;
44 
45 pub use cptrie::CodePointMapRange;
46 pub use cptrie::CodePointMapRangeIterator;
47 pub use cptrie::CodePointTrie;
48 pub use cptrie::CodePointTrieHeader;
49 pub use cptrie::TrieType;
50 pub use cptrie::TrieValue;
51 pub use error::Error as CodePointTrieError;
52