Trait TrieValue

trait TrieValue: Copy + Eq + PartialEq + zerovec::ule::AsULE + 'static

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.

This trait can be implemented on anything that can be represented as a u32s worth of data.

Associated Types

type TryFromU32Error: TraitBound { trait_: Path { path: "Display", id: Id(269), args: None }, generic_params: [], modifier: None }

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

fn try_from_u32(i: u32) -> Result<Self, <Self as >::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.

fn to_u32(self: 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)

Implementors