Struct ZeroAsciiIgnoreCaseTrie
struct ZeroAsciiIgnoreCaseTrie<Store: ?Sized> { ... }
A data structure that compactly maps from ASCII strings to integers in a case-insensitive way.
Examples
use LiteMap;
use ZeroAsciiIgnoreCaseTrie;
let mut map = new_vec;
map.insert;
map.insert;
map.insert;
let trie = try_from?;
assert_eq!;
assert_eq!;
assert_eq!;
assert_eq!;
assert_eq!;
# Ok::
Strings with different cases of the same character at the same offset are not allowed:
use LiteMap;
use ZeroAsciiIgnoreCaseTrie;
let mut map = new_vec;
map.insert;
// OK: 'r' and 'Z' are different letters
map.insert;
// Bad: we already inserted 'r' so we cannot also insert 'R' at the same position
map.insert;
try_from.expect_err;
Implementations
impl ZeroAsciiIgnoreCaseTrie<[u8]>
fn from_bytes(trie: &[u8]) -> &SelfCasts from a byte slice to a reference to a trie with the same lifetime.
If the bytes are not a valid trie, unexpected behavior may occur.
impl<'a> ZeroAsciiIgnoreCaseTrie<&'a [u8]>
fn into_cursor(self: Self) -> ZeroAsciiIgnoreCaseTrieCursor<'a>Same as [
ZeroAsciiIgnoreCaseTrie::cursor()] but moves self to avoid having to doubly anchor the trie to the stack.
impl<Store> ZeroAsciiIgnoreCaseTrie<Store>
fn get<K>(self: &Self, key: K) -> Option<usize> where K: AsRef<[u8]>Queries the trie for a string.
fn is_empty(self: &Self) -> boolReturns
trueif the trie is empty.fn byte_len(self: &Self) -> usizeReturns the size of the trie in number of bytes.
To get the number of keys in the trie, use
.iter().count():use ZeroAsciiIgnoreCaseTrie; // A trie with two values: "abc" and "abcdef" let trie: & = from_bytes; assert_eq!; assert_eq!;fn as_bytes(self: &Self) -> &[u8]Returns the bytes contained in the underlying store.
fn as_borrowed(self: &Self) -> &ZeroAsciiIgnoreCaseTrie<[u8]>Returns this trie as a reference transparent over a byte slice.
fn as_borrowed_slice(self: &Self) -> ZeroAsciiIgnoreCaseTrie<&[u8]>Returns a trie with a store borrowing from this trie.
impl<Store> ZeroAsciiIgnoreCaseTrie<Store>
const fn from_store(store: Store) -> SelfCreate a trie directly from a store.
If the store does not contain valid bytes, unexpected behavior may occur.
fn into_store(self: Self) -> StoreTakes the byte store from this trie.
fn convert_store<X: From<Store>>(self: Self) -> ZeroAsciiIgnoreCaseTrie<X>Converts this trie's store to a different store implementing the
Fromtrait.For example, use this to change
ZeroAsciiIgnoreCaseTrie<Vec<u8>>toZeroAsciiIgnoreCaseTrie<Cow<[u8]>>.Examples
use Cow; use ZeroAsciiIgnoreCaseTrie; let trie: = from_bytes.to_owned; let cow: = trie.convert_store; assert_eq!;
impl<Store> ZeroAsciiIgnoreCaseTrie<Store>
fn cursor(self: &Self) -> ZeroAsciiIgnoreCaseTrieCursor<'_>Gets a cursor into the current trie.
Useful to query a trie with data that is not a slice.
This is currently supported only on
ZeroTrieSimpleAsciiandZeroAsciiIgnoreCaseTrie.Examples
Get a value out of a trie by writing it to the cursor:
use Write; use ZeroAsciiIgnoreCaseTrie; // A trie with two values: "aBc" and "aBcdEf" let trie = from_bytes; // Get out the value for "abc" (case-insensitive!) let mut cursor = trie.cursor; write!; assert_eq!;For more examples, see
ZeroTrieSimpleAscii::cursor.
impl Borrow for ZeroAsciiIgnoreCaseTrie<&[u8]>
fn borrow(self: &Self) -> &ZeroAsciiIgnoreCaseTrie<[u8]>
impl<'zf, Store1, Store2> ZeroFrom for ZeroAsciiIgnoreCaseTrie<Store2>
fn zero_from(other: &'zf ZeroAsciiIgnoreCaseTrie<Store1>) -> Self
impl<Store> AsRef for ZeroAsciiIgnoreCaseTrie<Store>
fn as_ref(self: &Self) -> &ZeroAsciiIgnoreCaseTrie<[u8]>
impl<Store> Freeze for ZeroAsciiIgnoreCaseTrie<Store>
impl<Store> RefUnwindSafe for ZeroAsciiIgnoreCaseTrie<Store>
impl<Store> Send for ZeroAsciiIgnoreCaseTrie<Store>
impl<Store> Sync for ZeroAsciiIgnoreCaseTrie<Store>
impl<Store> Unpin for ZeroAsciiIgnoreCaseTrie<Store>
impl<Store> UnsafeUnpin for ZeroAsciiIgnoreCaseTrie<Store>
impl<Store> UnwindSafe for ZeroAsciiIgnoreCaseTrie<Store>
impl<Store: $crate::clone::Clone + ?Sized> Clone for ZeroAsciiIgnoreCaseTrie<Store>
fn clone(self: &Self) -> ZeroAsciiIgnoreCaseTrie<Store>
impl<Store: $crate::cmp::Eq + ?Sized> Eq for ZeroAsciiIgnoreCaseTrie<Store>
impl<Store: $crate::cmp::PartialEq + ?Sized> PartialEq for ZeroAsciiIgnoreCaseTrie<Store>
fn eq(self: &Self, other: &ZeroAsciiIgnoreCaseTrie<Store>) -> bool
impl<Store: $crate::default::Default + ?Sized> Default for ZeroAsciiIgnoreCaseTrie<Store>
fn default() -> ZeroAsciiIgnoreCaseTrie<Store>
impl<Store: $crate::fmt::Debug + ?Sized> Debug for ZeroAsciiIgnoreCaseTrie<Store>
fn fmt(self: &Self, f: &mut Formatter<'_>) -> Result
impl<Store: $crate::marker::Copy + ?Sized> Copy for ZeroAsciiIgnoreCaseTrie<Store>
impl<Store: ?Sized> StructuralPartialEq for ZeroAsciiIgnoreCaseTrie<Store>
impl<T> Any for ZeroAsciiIgnoreCaseTrie<Store>
fn type_id(self: &Self) -> TypeId
impl<T> Borrow for ZeroAsciiIgnoreCaseTrie<Store>
fn borrow(self: &Self) -> &T
impl<T> BorrowMut for ZeroAsciiIgnoreCaseTrie<Store>
fn borrow_mut(self: &mut Self) -> &mut T
impl<T> CloneToUninit for ZeroAsciiIgnoreCaseTrie<Store>
unsafe fn clone_to_uninit(self: &Self, dest: *mut u8)
impl<T> ErasedDestructor for ZeroAsciiIgnoreCaseTrie<Store>
impl<T> From for ZeroAsciiIgnoreCaseTrie<Store>
fn from(t: T) -> TReturns the argument unchanged.
impl<T> ToOwned for ZeroAsciiIgnoreCaseTrie<Store>
fn to_owned(self: &Self) -> Tfn clone_into(self: &Self, target: &mut T)
impl<T, U> Into for ZeroAsciiIgnoreCaseTrie<Store>
fn into(self: Self) -> UCalls
U::from(self).That is, this conversion is whatever the implementation of
[From]<T> for Uchooses to do.
impl<T, U> TryFrom for ZeroAsciiIgnoreCaseTrie<Store>
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
impl<T, U> TryInto for ZeroAsciiIgnoreCaseTrie<Store>
fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error>