Skip to main content

Module codepointtrie

Module codepointtrie 

Source
Expand description

This module provides a data structure for an time-efficient lookup of values associated to code points.

It is an implementation of the existing ICU4C UCPTrie / ICU4J CodePointTrie API.

§Architecture

ICU4X CodePointTrie is designed to provide a read-only view of CodePointTrie data that is exported from ICU4C. Detailed information about the design of the data structure can be found in the documentation for the CodePointTrie struct.

§Examples

§Querying a CodePointTrie

use icu::collections::codepointtrie::planes;
let trie = planes::get_planes_trie();

assert_eq!(0, trie.get32(0x41)); // 'A' as u32
assert_eq!(0, trie.get32(0x13E0)); // 'Ꮰ' as u32
assert_eq!(1, trie.get32(0x10044)); // '𐁄' as u32

Modules§

cptrie 🔒
error 🔒
Custom error type(s) for the parent module.
impl_const 🔒
iter 🔒
planes
Sample data for CodePointTrie that returns the code point’s plane number.

Structs§

CharIndicesWithTrie
Iterator over str by char and TrieValue.
CharIndicesWithTrieDefaultForAscii
Iterator over str by char and TrieValue.
CharIterWithTrie
Wraps an Iterator<Item = char> with a reference to an AbstractCodePointTrie.
CharsWithTrie
Iterator over str by char and TrieValue.
CharsWithTrieDefaultForAscii
Iterator over str by char and TrieValue but the trie value for ASCII is V::default() instead of reading from the trie. (V::default() can be optimized on at compile time while reading the trie’s default value is a run-time operation.)
CodePointMapRange
Represents a range of consecutive code points sharing the same value in a code point map.
CodePointMapRangeIterator
A custom Iterator type specifically for a code point trie that returns CodePointMapRanges.
CodePointTrie
This struct represents a de-serialized CodePointTrie that was exported from ICU binary data.
CodePointTrieHeader
This struct contains the fixed-length header fields of a CodePointTrie.
FastCodePointTrie
Type-safe wrapper for a fast trie guaranteeing the the getters don’t branch on the trie type and for guarenteeing that get16 is branchless in release builds.
Latin1CharIndicesWithTrie
Iterator over str by char and TrieValue.
Latin1CharsWithTrie
Iterator over Latin1 [u8] by char and TrieValue.
SmallCodePointTrie
Type-safe wrapper for a small trie guaranteeing the the getters don’t branch on the trie type.

Enums§

CodePointTrieError
A custom error type for CodePointTrie.
TrieType
The type of trie represents whether the trie has an optimization that would make it smaller or faster.
Typed
Holder for either fast or small trie with the trie type encoded into the Rust type.

Traits§

AbstractCodePointTrie
Trait for writing trait bounds for monomorphizing over either CodePointTrie, FastCodePointTrie, or SmallCodePointTrie.
CharsWithTrieDefaultForAsciiEx
Adds convenience methods to str.
CharsWithTrieEx
Adds convenience methods to str.
Latin1CharsWithTrieEx
Adds convenience methods to [u8].
TrieValue
A trait representing the values stored in the data array of a CodePointTrie. This trait is used as a type parameter in constructing a CodePointTrie.
TypedCodePointTrie
Trait for writing trait bounds for monomorphizing over either FastCodePointTrie or SmallCodePointTrie.
WithTrie
Provides a trie accessor for types (likely iterators) that are holding a reference to a type that implements AbstractCodePointTrie.