Skip to main content

AbstractCodePointTrie

Trait AbstractCodePointTrie 

Source
pub trait AbstractCodePointTrie<'trie, T: TrieValue>: Seal {
    // Required methods
    unsafe fn ascii(&self, ascii: u8) -> T;
    unsafe fn utf8_two_byte(&self, high_five: u32, low_six: u32) -> T;
    unsafe fn utf8_three_byte(&self, high_ten: u32, low_six: u32) -> T;
    fn latin1(&self, latin1: u8) -> T;
    fn bmp(&self, bmp: u16) -> T;
    fn supplementary(&self, supplementary: u32) -> T;
    fn scalar(&self, scalar: char) -> T;
    fn code_point(&self, code_point: u32) -> T;
}
Expand description

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

Method naming intentionally differs from the method naming on those types in order to disambiguate.

Required Methods§

Source

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

Look up trie value by an ASCII character.

§Safety

ascii must be less than 128.

Source

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

Look up trie value by 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.

Source

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

Look up trie value by 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.

Source

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

Look up trie value by a Latin1 character.

Source

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

Look up trie value by a Basic Multilingual Plane character.

Surrogate values are allowed.

Source

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

Look up trie value by a non-Basic Multilingual Plane character.

The behavior is memory-safe nonsense if the argument is not actually a non-Basic Multilingual Plane character.

Source

fn scalar(&self, scalar: char) -> T

Look up trie value by a Unicode Scalar Value.

Source

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

Look up trie value by Unicode Code Point.

Surrogate values are allowed. Out of range input results in the error value.

Implementors§

Source§

impl<'trie, T: TrieValue> AbstractCodePointTrie<'trie, T> for CodePointTrie<'trie, T>

Source§

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

Source§

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