pub struct Char16TrieIterator<'a> { /* private fields */ }
Expand description

This struct represents an iterator over a Char16Trie.

Implementations

Returns a new Char16TrieIterator backed by borrowed data for the trie array

Traverses the trie from the current state for this input char.

Examples
use icu_collections::char16trie::{Char16Trie, TrieResult};
use zerovec::ZeroVec;

// A Char16Trie containing the ASCII characters 'a' and 'b'.
let trie_data = vec![48, 97, 176, 98, 32868];
let trie =
    Char16Trie::new(ZeroVec::from_slice_or_alloc(trie_data.as_slice()));

let mut iter = trie.iter();
let res = iter.next('a');
assert_eq!(res, TrieResult::Intermediate(1));
let res = iter.next('b');
assert_eq!(res, TrieResult::FinalValue(100));
let res = iter.next('c');
assert_eq!(res, TrieResult::NoMatch);

Traverses the trie from the current state for this input char.

Examples
use icu_collections::char16trie::{Char16Trie, TrieResult};
use zerovec::ZeroVec;

// A Char16Trie containing the ASCII characters 'a' and 'b'.
let trie_data = vec![48, 97, 176, 98, 32868];
let trie =
    Char16Trie::new(ZeroVec::from_slice_or_alloc(trie_data.as_slice()));

let mut iter = trie.iter();
let res = iter.next('a');
assert_eq!(res, TrieResult::Intermediate(1));
let res = iter.next('b');
assert_eq!(res, TrieResult::FinalValue(100));
let res = iter.next('c');
assert_eq!(res, TrieResult::NoMatch);

Traverses the trie from the current state for this input char.

Examples
use icu_collections::char16trie::{Char16Trie, TrieResult};
use zerovec::ZeroVec;

// A Char16Trie containing the ASCII characters 'a' and 'b'.
let trie_data = vec![48, 97, 176, 98, 32868];
let trie =
    Char16Trie::new(ZeroVec::from_slice_or_alloc(trie_data.as_slice()));

let mut iter = trie.iter();
let res = iter.next16('a' as u16);
assert_eq!(res, TrieResult::Intermediate(1));
let res = iter.next16('b' as u16);
assert_eq!(res, TrieResult::FinalValue(100));
let res = iter.next16('c' as u16);
assert_eq!(res, TrieResult::NoMatch);

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.