Trait icu::collections::codepointtrie::TrieValue
source · pub trait TrieValue:
Copy
+ Eq
+ PartialEq
+ AsULE
+ 'static {
type TryFromU32Error: Display;
// Required methods
fn try_from_u32(i: u32) -> Result<Self, Self::TryFromU32Error>;
fn to_u32(self) -> u32;
}
Expand description
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
.
Required Associated Types§
sourcetype TryFromU32Error: Display
type TryFromU32Error: Display
Last-resort fallback value to return if we cannot read data from the trie.
In most cases, the error value is read from the last element of the data
array,
this value is used for empty codepointtrie arrays
Error type when converting from a u32 to this TrieValue
.
Required Methods§
sourcefn try_from_u32(i: u32) -> Result<Self, Self::TryFromU32Error>
fn try_from_u32(i: u32) -> Result<Self, Self::TryFromU32Error>
A parsing function that is primarily motivated by deserialization contexts.
When the serialization type width is smaller than 32 bits, then it is expected
that the call site will widen the value to a u32
first.
sourcefn to_u32(self) -> u32
fn to_u32(self) -> u32
A method for converting back to a u32
that can roundtrip through
Self::try_from_u32()
. The default implementation of this trait
method panics in debug mode and returns 0 in release mode.
This method is allowed to have GIGO behavior when fed a value that has
no corresponding u32
(since such values cannot be stored in the trie)