Struct ZeroTriePerfectHash
struct ZeroTriePerfectHash<Store: ?Sized> { ... }
A data structure that compactly maps from byte strings to integers.
For more information, see ZeroTrie.
Examples
use LiteMap;
use ZeroTriePerfectHash;
let mut map = new_vec;
map.insert;
map.insert;
map.insert;
let trie = try_from?;
assert_eq!;
assert_eq!;
assert_eq!;
assert_eq!;
# Ok::
Implementations
impl ZeroTriePerfectHash<[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<Store> ZeroTriePerfectHash<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 ZeroTriePerfectHash; // 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) -> &ZeroTriePerfectHash<[u8]>Returns this trie as a reference transparent over a byte slice.
fn as_borrowed_slice(self: &Self) -> ZeroTriePerfectHash<&[u8]>Returns a trie with a store borrowing from this trie.
impl<Store> ZeroTriePerfectHash<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) -> ZeroTriePerfectHash<X>Converts this trie's store to a different store implementing the
Fromtrait.For example, use this to change
ZeroTriePerfectHash<Vec<u8>>toZeroTriePerfectHash<Cow<[u8]>>.Examples
use Cow; use ZeroTriePerfectHash; let trie: = from_bytes.to_owned; let cow: = trie.convert_store; assert_eq!;
impl<Store> ZeroTriePerfectHash<Store>
const fn into_zerotrie(self: Self) -> ZeroTrie<Store>Wrap this specific ZeroTrie variant into a ZeroTrie.
impl Borrow for ZeroTriePerfectHash<&[u8]>
fn borrow(self: &Self) -> &ZeroTriePerfectHash<[u8]>
impl<'zf, Store1, Store2> ZeroFrom for ZeroTriePerfectHash<Store2>
fn zero_from(other: &'zf ZeroTriePerfectHash<Store1>) -> Self
impl<Store> AsRef for ZeroTriePerfectHash<Store>
fn as_ref(self: &Self) -> &ZeroTriePerfectHash<[u8]>
impl<Store> Freeze for ZeroTriePerfectHash<Store>
impl<Store> RefUnwindSafe for ZeroTriePerfectHash<Store>
impl<Store> Send for ZeroTriePerfectHash<Store>
impl<Store> Sync for ZeroTriePerfectHash<Store>
impl<Store> Unpin for ZeroTriePerfectHash<Store>
impl<Store> UnsafeUnpin for ZeroTriePerfectHash<Store>
impl<Store> UnwindSafe for ZeroTriePerfectHash<Store>
impl<Store: $crate::clone::Clone + ?Sized> Clone for ZeroTriePerfectHash<Store>
fn clone(self: &Self) -> ZeroTriePerfectHash<Store>
impl<Store: $crate::cmp::Eq + ?Sized> Eq for ZeroTriePerfectHash<Store>
impl<Store: $crate::cmp::PartialEq + ?Sized> PartialEq for ZeroTriePerfectHash<Store>
fn eq(self: &Self, other: &ZeroTriePerfectHash<Store>) -> bool
impl<Store: $crate::default::Default + ?Sized> Default for ZeroTriePerfectHash<Store>
fn default() -> ZeroTriePerfectHash<Store>
impl<Store: $crate::fmt::Debug + ?Sized> Debug for ZeroTriePerfectHash<Store>
fn fmt(self: &Self, f: &mut Formatter<'_>) -> Result
impl<Store: $crate::marker::Copy + ?Sized> Copy for ZeroTriePerfectHash<Store>
impl<Store: ?Sized> StructuralPartialEq for ZeroTriePerfectHash<Store>
impl<T> Any for ZeroTriePerfectHash<Store>
fn type_id(self: &Self) -> TypeId
impl<T> Borrow for ZeroTriePerfectHash<Store>
fn borrow(self: &Self) -> &T
impl<T> BorrowMut for ZeroTriePerfectHash<Store>
fn borrow_mut(self: &mut Self) -> &mut T
impl<T> CloneToUninit for ZeroTriePerfectHash<Store>
unsafe fn clone_to_uninit(self: &Self, dest: *mut u8)
impl<T> ErasedDestructor for ZeroTriePerfectHash<Store>
impl<T> From for ZeroTriePerfectHash<Store>
fn from(t: T) -> TReturns the argument unchanged.
impl<T> ToOwned for ZeroTriePerfectHash<Store>
fn to_owned(self: &Self) -> Tfn clone_into(self: &Self, target: &mut T)
impl<T, U> Into for ZeroTriePerfectHash<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 ZeroTriePerfectHash<Store>
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
impl<T, U> TryInto for ZeroTriePerfectHash<Store>
fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error>