Skip to main content

TypedCodePointTrie

Trait TypedCodePointTrie 

Source
pub trait TypedCodePointTrie<'trie, T: TrieValue>: Seal {
    const TRIE_TYPE: TrieType;

    // Required methods
    fn as_untyped_ref(&self) -> &CodePointTrie<'trie, T>;
    fn to_untyped(self) -> CodePointTrie<'trie, T>;

    // Provided methods
    fn get32_u32(&self, code_point: u32) -> u32 { ... }
    fn get16(&self, bmp: u16) -> T { ... }
    fn get8(&self, latin1: u8) -> T { ... }
    unsafe fn get7(&self, ascii: u8) -> T { ... }
    fn get32_supplementary(&self, supplementary: u32) -> T { ... }
    fn get(&self, c: char) -> T { ... }
    fn get32(&self, code_point: u32) -> T { ... }
    fn get32_by_fast_index(&self, code_point: u32) -> Option<T> { ... }
    unsafe fn get_utf8_two_byte(&self, high_five: u32, low_six: u32) -> T { ... }
    unsafe fn get_utf8_three_byte(&self, high_ten: u32, low_six: u32) -> T { ... }
}
Expand description

Trait for writing trait bounds for monomorphizing over either FastCodePointTrie or SmallCodePointTrie.

Required Associated Constants§

Source

const TRIE_TYPE: TrieType

The TrieType associated with this TypedCodePointTrie

§Safety Usable Invariant

This constant matches self.as_untyped_ref().header.trie_type.

Required Methods§

Source

fn as_untyped_ref(&self) -> &CodePointTrie<'trie, T>

Returns a reference to the wrapped CodePointTrie.

Source

fn to_untyped(self) -> CodePointTrie<'trie, T>

Extracts the wrapped CodePointTrie.

Provided Methods§

Source

fn get32_u32(&self, code_point: u32) -> u32

Lookup trie value as u32 by Unicode Scalar Value without branching on trie type.

Source

fn get16(&self, bmp: u16) -> T

Lookup trie value by Basic Multilingual Plane Code Point without branching on trie type.

Source

fn get8(&self, latin1: u8) -> T

Lookup trie value by Latin1 Code Point without branching on trie type.

Source

unsafe fn get7(&self, ascii: u8) -> T

Lookup trie value by ASCII Code Point without branching on trie type.

§Safety

ascii must be less than 128.

Source

fn get32_supplementary(&self, supplementary: u32) -> T

Lookup trie value by non-Basic Multilingual Plane Scalar Value without branching on trie type.

Source

fn get(&self, c: char) -> T

Lookup trie value by Unicode Scalar Value without branching on trie type.

Source

fn get32(&self, code_point: u32) -> T

Lookup trie value by Unicode Code Point without branching on trie type.

Source

fn get32_by_fast_index(&self, code_point: u32) -> Option<T>

Returns the value that is associated with code_point in this CodePointTrie if code_point uses fast-path lookup or None if code_point should use small-path lookup or is above the supported range.

Source

unsafe fn get_utf8_two_byte(&self, high_five: u32, low_six: u32) -> T

Returns the value that is associated with a two-byte UTF-8 sequence.

high_five is the low five bits of the lead byte of a two-byte UTF-8 sequence. low_six is the low six bits of the trail byte of a two-byte UTF-8 sequence.

§Safety

high_five must not have bit positions other than the lowest 5 set to 1. low_six must not have bit positions other than the lowest 6 set to 1.

§Panics

With debug assertions enabled, panics if the above safety invariants are violated or high_five represents non-shortest form.

Source

unsafe fn get_utf8_three_byte(&self, high_ten: u32, low_six: u32) -> T

Returns the value that is associated with a three-byte UTF-8 or WTF-8 sequence.

high_ten is the low four bits of the lead byte of three-byte UTF-8 or WTF-8 sequence shifted left by 6 followed by the low six bits of the first trail byte. low_six is the low six bits of the last trail byte of a three-byte UTF-8 or WTF-8 sequence.

Sequences representing surrogates (WTF-8) are allowed.

§Safety

high_ten must not have bit positions other than the lowest 10 set to 1. low_six must not have bit positions other than the lowest 6 set to 1.

§Panics

With debug assertions enabled, panics if the above safety invariants are violated or high_ten is out of range for three-byte WTF-8 (or UTF-8) sequence.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<'trie, T: TrieValue> TypedCodePointTrie<'trie, T> for FastCodePointTrie<'trie, T>

Source§

const TRIE_TYPE: TrieType = TrieType::Fast

Source§

impl<'trie, T: TrieValue> TypedCodePointTrie<'trie, T> for SmallCodePointTrie<'trie, T>

Source§

const TRIE_TYPE: TrieType = TrieType::Small