Expand description
This module holds the 64-bit CollationElement struct used for
the actual comparison, the 32-bit CollationElement32 struct
that’s used for storage. (Strictly speaking, the storage is
RawBytesULE<4>.) And the CollationElements iterator adapter
that turns an iterator over char into an iterator over
CollationElement. (To match the structure of ICU4C, this isn’t
a real Rust Iterator. Instead of signaling end by returning
None, it signals end by returning NO_CE.)
This module also declares various constants that are also used
by the comparison module.
Structs§
- Character
AndClass 🔒 - Pack a
charand aCanonicalCombiningClassin 32 bits (the former in the lower 24 bits and the latter in the high 8 bits). The latter can be initialized to 0xFF upon creation, in which case it can be actually set later by callingset_ccc_from_trie_if_not_already_set. This is a micro optimization to avoid the Canonical Combining Class trie lookup when there is only one combining character in a sequence. This type is intentionally non-Copyto get compiler help in making sure that the class is set on the instance on which it is intended to be set and not on a temporary copy. - Character
AndClass 🔒AndTrie Value - This struct makes the handling of the
upcomingbuffer easily so that trie lookups are done at most once. However, whenupcoming[0]is an undecomposed starter, we don’t need the ccc yet, and when lookahead has already done the trie lookups, we don’t needtrie_value, as it is implied by ccc. - Collation
Element 🔒 - A collation element is a 64-bit value.
- Collation
Element32 🔒 - A compressed form of a collation element as stored in the collation data.
- Collation
Elements 🔒 - Iterator that transforms an iterator over
charinto an iterator overCollationElementwith a tailoring. Not a real Rust iterator: Instead ofNoneusesNO_CEto indicate end of iteration to optimize comparison. - NonPrimary 🔒
- The purpose of grouping the non-primary bits
into a struct is to allow for a future optimization
that specializes code over whether storage for primary
weights is needed or not. (I.e. whether to specialize
on
CollationElementorNonPrimary.)
Enums§
- Tag 🔒
- Special-CE32 tags, from bits 3..0 of a special 32-bit CE. Bits 31..8 are available for tag-specific data. Bits 5..4: Reserved. May be used in the future to indicate lccc!=0 and tccc!=0.
Constants§
- BACKWARD_
COMBINING_ 🔒MARKER - Marker that the first character of the decomposition can combine backwards.
- CASE_
MASK 🔒 - CE_
BUFFER_ 🔒SIZE - The number of full 64-bit collation units that get buffered in the primary comparison loop so that they can be examined by the subsequent comparison stregths.
- COMBINING_
CHARACTER_ 🔒BUFFER_ SIZE - The contiguous sequence of combining characters.
- COMBINING_
DIACRITICS_ 🔒BASE - COMMON_
SECONDARY_ 🔒CE - COMMON_
SEC_ 🔒AND_ TER_ CE - COMMON_
TERTIARY_ 🔒CE - CONTRACT_
HAS_ 🔒STARTER - Set if at least one contraction suffix contains a starter
- CONTRACT_
NEXT_ 🔒CCC - Set if the first character of every contraction suffix has lccc!=0.
- CONTRACT_
TRAILING_ 🔒CCC - Set if any contraction suffix ends with lccc!=0.
- DIGIT_
BUFFER_ 🔒SIZE - The sequence of digits in the numeric mode.
- EMPTY_
CHAR 🔒 - EMPTY_
U16 🔒 - FALLBACK_
CE32 🔒 - FDFA_
MARKER 🔒 - Marker value for U+FDFA in NFKD. (Unified with
HANGUL_SYLLABLE_MARKER, but they differ byNON_ROUND_TRIP_MARKER.) - FFFD_CE 🔒
- FFFD_
CE32 🔒 - FFFD_
CE32_ 🔒VALUE - FFFD_
CE_ 🔒VALUE - FFFD_
PRIMARY 🔒 - HANGUL_
L_ 🔒BASE - HANGUL_
N_ 🔒COUNT - HANGUL_
SYLLABLE_ 🔒MARKER - Marker value for Hangul syllables. (Unified with
FDFA_MARKER, but they differ byNON_ROUND_TRIP_MARKER.) - HANGUL_
S_ 🔒BASE - HANGUL_
S_ 🔒COUNT - HANGUL_
T_ 🔒BASE - HANGUL_
T_ 🔒COUNT - HANGUL_
V_ 🔒BASE - HIGH_
ZEROS_ 🔒MASK - Mask for the bits have to be zero for this to be a BMP singleton decomposition, or value baked into the surrogate range.
- IDENTICAL_
PREFIX_ 🔒HANGUL_ MARKER_ CE32 - Used only as a placeholder on the indentical prefix path.
The requirement is that this CE32 fails the quick mapping to a primary,
which is does, because the tag byte is higher than
LONG_PRIMARY_CE32_LOW_BYTE. - JAMO_
COUNT 🔒 - LONG_
PRIMARY_ 🔒CE32_ LOW_ BYTE - LOW_
ZEROS_ 🔒MASK - Mask for the bits have to be zero for this to be a complex decomposition.
- NON_
ROUND_ 🔒TRIP_ MARKER - Marker that the decomposition does not round trip via NFC.
- NO_CE 🔒
- NO_
CE_ 🔒PRIMARY - NO_
CE_ 🔒QUATERNARY - NO_
CE_ 🔒SECONDARY - NO_
CE_ 🔒TERTIARY - NO_
CE_ 🔒VALUE - OPTIMIZED_
DIACRITICS_ 🔒LIMIT - OPTIMIZED_
DIACRITICS_ 🔒MAX_ COUNT - PENDING_
CE_ 🔒BUFFER_ SIZE - The number of extra full 64-bit collation units that have already been computed as part of an operation that yields multiple collation units at a time.
- PENDING_
REMOVALS_ 🔒SIZE - The number of combining characters that a contraction has matched.
- QUATERNARY_
MASK 🔒 - SINGLE_
REPLACEMENT_ 🔒CHARACTER_ CHAR - SINGLE_
REPLACEMENT_ 🔒CHARACTER_ U16 - SPECIAL_
CE32_ 🔒LOW_ BYTE - TERTIARY_
MASK 🔒 - UNASSIGNED_
IMPLICIT_ 🔒BYTE - UPCOMING_
CHARACTER_ 🔒BUFFER_ SIZE - Either the identical prefix or the lookahead plus the next upcoming character.
Functions§
- ccc_
from_ 🔒trie_ value - Extracts a canonical combining class (possibly zero) from a trie value.
- char_
from_ 🔒u16 - Convert a
u16obtained from data provider data tochar. - char_
from_ 🔒u32 - Convert a
u32obtained from data provider data tochar. - decomposition_
starts_ 🔒with_ non_ starter - Checks if a trie value signifies a character whose decomposition starts with a non-starter.
- in_
inclusive_ 🔒range - trie_
value_ 🔒has_ ccc - Checks if a trie value carries a (non-zero) canonical combining class.
- trie_
value_ 🔒indicates_ special_ non_ starter_ decomposition - Checks if the trie signifies a special non-starter decomposition.
- unwrap_
or_ 🔒gigo - If
optisSome, unwrap it. IfNone, panic if debug assertions are enabled and returndefaultif debug assertions are not enabled.