Struct Char16TrieIterator

struct Char16TrieIterator<'a> { ... }

This struct represents an iterator over a Char16Trie.

Implementations

impl<'a> Char16TrieIterator<'a>

fn new(trie: &'a ZeroSlice<u16>) -> Self

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

fn next(self: &mut Self, c: char) -> TrieResult

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 = [48, 97, 176, 98, 32868];
let trie = Char16Trie::new(ZeroVec::from_slice_or_alloc(&trie_data));

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);
fn next32(self: &mut Self, c: u32) -> TrieResult

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 = [48, 97, 176, 98, 32868];
let trie = Char16Trie::new(ZeroVec::from_slice_or_alloc(&trie_data));

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);
fn next16(self: &mut Self, c: u16) -> TrieResult

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 = [48, 97, 176, 98, 32868];
let trie = Char16Trie::new(ZeroVec::from_slice_or_alloc(&trie_data));

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);

impl<'a> Clone for Char16TrieIterator<'a>

fn clone(self: &Self) -> Char16TrieIterator<'a>

impl<'a> Freeze for Char16TrieIterator<'a>

impl<'a> RefUnwindSafe for Char16TrieIterator<'a>

impl<'a> Send for Char16TrieIterator<'a>

impl<'a> Sync for Char16TrieIterator<'a>

impl<'a> Unpin for Char16TrieIterator<'a>

impl<'a> UnsafeUnpin for Char16TrieIterator<'a>

impl<'a> UnwindSafe for Char16TrieIterator<'a>

impl<T> Any for Char16TrieIterator<'a>

fn type_id(self: &Self) -> TypeId

impl<T> Borrow for Char16TrieIterator<'a>

fn borrow(self: &Self) -> &T

impl<T> BorrowMut for Char16TrieIterator<'a>

fn borrow_mut(self: &mut Self) -> &mut T

impl<T> CloneToUninit for Char16TrieIterator<'a>

unsafe fn clone_to_uninit(self: &Self, dest: *mut u8)

impl<T> ErasedDestructor for Char16TrieIterator<'a>

impl<T> From for Char16TrieIterator<'a>

fn from(t: T) -> T

Returns the argument unchanged.

impl<T> ToOwned for Char16TrieIterator<'a>

fn to_owned(self: &Self) -> T
fn clone_into(self: &Self, target: &mut T)

impl<T, U> Into for Char16TrieIterator<'a>

fn into(self: Self) -> U

Calls U::from(self).

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

impl<T, U> TryFrom for Char16TrieIterator<'a>

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

impl<T, U> TryInto for Char16TrieIterator<'a>

fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error>