pub struct BinaryViewIndexMap<V> { /* private fields */ }Expand description
An IndexMap where the keys are u8 slices or Views which are pre-hashed.
Does not support deletion.
Implementations§
Source§impl<V> BinaryViewIndexMap<V>
impl<V> BinaryViewIndexMap<V>
pub fn new() -> Self
pub fn reserve(&mut self, additional: usize)
pub fn len(&self) -> IdxSize
pub fn is_empty(&self) -> bool
pub fn buffers(&self) -> &[Vec<u8>]
pub fn get(&self, hash: u64, key: &[u8]) -> Option<&V>
Sourcepub unsafe fn get_view<B: AsRef<[u8]>>(
&self,
hash: u64,
key: &View,
buffers: &[B],
) -> Option<&V>
pub unsafe fn get_view<B: AsRef<[u8]>>( &self, hash: u64, key: &View, buffers: &[B], ) -> Option<&V>
§Safety
The view must be valid in combination with the given buffers.
Sourcepub unsafe fn get_inline_view(&self, hash: u64, key: &View) -> Option<&V>
pub unsafe fn get_inline_view(&self, hash: u64, key: &View) -> Option<&V>
§Safety
The view must be inlined.
Sourcepub unsafe fn get_long_key(&self, hash: u64, key: &[u8]) -> Option<&V>
pub unsafe fn get_long_key(&self, hash: u64, key: &[u8]) -> Option<&V>
§Safety
key.len() > View::MAX_INLINE_SIZE
pub fn entry<'k>(&mut self, hash: u64, key: &'k [u8]) -> Entry<'_, 'k, V>
Sourcepub unsafe fn entry_view<'k, B: AsRef<[u8]>>(
&mut self,
hash: u64,
key: View,
buffers: &'k [B],
) -> Entry<'_, 'k, V>
pub unsafe fn entry_view<'k, B: AsRef<[u8]>>( &mut self, hash: u64, key: View, buffers: &'k [B], ) -> Entry<'_, 'k, V>
§Safety
The view must be valid in combination with the given buffers.
Sourcepub unsafe fn entry_inline_view<'k>(
&mut self,
hash: u64,
key: View,
) -> Entry<'_, 'k, V>
pub unsafe fn entry_inline_view<'k>( &mut self, hash: u64, key: View, ) -> Entry<'_, 'k, V>
§Safety
The view must be inlined.
Sourcepub unsafe fn entry_long_key<'k>(
&mut self,
hash: u64,
key: &'k [u8],
) -> Entry<'_, 'k, V>
pub unsafe fn entry_long_key<'k>( &mut self, hash: u64, key: &'k [u8], ) -> Entry<'_, 'k, V>
§Safety
key.len() > View::MAX_INLINE_SIZE
Sourcepub fn push_unmapped_empty_entry(&mut self, value: V) -> IdxSize
pub fn push_unmapped_empty_entry(&mut self, value: V) -> IdxSize
Insert an empty entry which will never be mapped to. Returns the index of the entry.
This is useful for entries which are handled externally.
Sourcepub fn get_index(&self, idx: IdxSize) -> Option<(u64, &[u8], &V)>
pub fn get_index(&self, idx: IdxSize) -> Option<(u64, &[u8], &V)>
Gets the hash, key and value at the given index by insertion order.
Sourcepub unsafe fn get_index_unchecked(&self, idx: IdxSize) -> (u64, &[u8], &V)
pub unsafe fn get_index_unchecked(&self, idx: IdxSize) -> (u64, &[u8], &V)
Gets the hash, key and value at the given index by insertion order.
§Safety
The index must be less than len().
Sourcepub unsafe fn get_index_view_unchecked(&self, idx: IdxSize) -> (u64, View, &V)
pub unsafe fn get_index_view_unchecked(&self, idx: IdxSize) -> (u64, View, &V)
Gets the hash, view and value at the given index by insertion order.
§Safety
The index must be less than len().
Sourcepub fn iter_hash_keys(&self) -> impl Iterator<Item = (u64, &[u8])>
pub fn iter_hash_keys(&self) -> impl Iterator<Item = (u64, &[u8])>
Iterates over the (hash, key) pairs in insertion order.
Sourcepub fn iter_hash_views(&self) -> impl Iterator<Item = (u64, View)>
pub fn iter_hash_views(&self) -> impl Iterator<Item = (u64, View)>
Iterates over the (hash, key_view) pairs in insertion order.
Sourcepub fn iter_values(&self) -> impl Iterator<Item = &V>
pub fn iter_values(&self) -> impl Iterator<Item = &V>
Iterates over the values in insertion order.
Trait Implementations§
Auto Trait Implementations§
impl<V> Freeze for BinaryViewIndexMap<V>
impl<V> RefUnwindSafe for BinaryViewIndexMap<V>where
V: RefUnwindSafe,
impl<V> Send for BinaryViewIndexMap<V>where
V: Send,
impl<V> Sync for BinaryViewIndexMap<V>where
V: Sync,
impl<V> Unpin for BinaryViewIndexMap<V>where
V: Unpin,
impl<V> UnwindSafe for BinaryViewIndexMap<V>where
V: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more