usesuper::Utf8CharsWithTrie; usesuper::Utf8CharsWithTrieDefaultForAscii; use core::iter::FusedIterator;
use icu_collections::codepointtrie::AbstractCodePointTrie; use icu_collections::codepointtrie::TrieValue; use icu_collections::codepointtrie::WithTrie;
/// An iterator over the [`char`]s and their positions. #[derive(Debug)] #[must_use = "iterators are lazy and do nothing unless consumed"] pubstruct Utf8CharIndicesWithTrie<'slice, 'trie, T, V> where
V: TrieValue,
T: AbstractCodePointTrie<'trie, V>,
{
front_offset: usize,
iter: Utf8CharsWithTrie<'slice, 'trie, T, V>,
}
/// Views the underlying data as a subslice of the original data. /// /// This has the same lifetime as the original slice, and so the /// iterator can continue to be used while this exists. #[must_use] #[inline] pubfn as_slice(&self) -> &'slice [u8] { self.iter.as_slice()
}
/// Returns the code unit position of the next character, or the length /// of the underlying string if there are no more characters. #[inline] #[must_use] pubfn offset(&self) -> usize { self.front_offset
}
}
// --
/// An iterator over the [`char`]s and their positions. #[derive(Debug)] #[must_use = "iterators are lazy and do nothing unless consumed"] pubstruct Utf8CharIndicesWithTrieDefaultForAscii<'slice, 'trie, T, V> where
V: TrieValue + Default,
T: AbstractCodePointTrie<'trie, V>,
{
front_offset: usize,
iter: Utf8CharsWithTrieDefaultForAscii<'slice, 'trie, T, V>,
}
/// Views the underlying data as a subslice of the original data. /// /// This has the same lifetime as the original slice, and so the /// iterator can continue to be used while this exists. #[must_use] #[inline] pubfn as_slice(&self) -> &'slice [u8] { self.iter.as_slice()
}
/// Returns the code unit position of the next character, or the length /// of the underlying string if there are no more characters. #[inline] #[must_use] pubfn offset(&self) -> usize { self.front_offset
}
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.