pub struct HashTable<C: Config, D: Borrow<[u8]>> { /* private fields */ }
Expand description
The HashTable type provides a cheap way to construct a non-resizable view
of a persisted hash table. If the underlying data storage D
implements
BorrowMut<[u8]>
then the table can be modified in place.
Implementations§
Source§impl<C: Config, D: Borrow<[u8]>> HashTable<C, D>
impl<C: Config, D: Borrow<[u8]>> HashTable<C, D>
Sourcepub fn from_raw_bytes(data: D) -> Result<HashTable<C, D>, Box<dyn Error>>
pub fn from_raw_bytes(data: D) -> Result<HashTable<C, D>, Box<dyn Error>>
Constructs a HashTable from its raw byte representation. The provided data must have the exact right number of bytes.
This method has constant time complexity and will only verify the header data of the hash table. It will not copy any data.
Sourcepub unsafe fn from_raw_bytes_unchecked(data: D) -> HashTable<C, D>
pub unsafe fn from_raw_bytes_unchecked(data: D) -> HashTable<C, D>
Constructs a HashTable from its raw byte representation without doing any verification of the underlying data. It is the user’s responsibility to make sure that the underlying data is actually a valid hash table.
The HashTable::from_raw_bytes method provides a safe alternative to this method.
pub fn get(&self, key: &C::Key) -> Option<C::Value>
pub fn contains_key(&self, key: &C::Key) -> bool
pub fn iter(&self) -> Iter<'_, C> ⓘ
pub fn raw_bytes(&self) -> &[u8] ⓘ
Trait Implementations§
impl<C: Copy + Config, D: Copy + Borrow<[u8]>> Copy for HashTable<C, D>
Auto Trait Implementations§
impl<C, D> Freeze for HashTable<C, D>where
D: Freeze,
impl<C, D> RefUnwindSafe for HashTable<C, D>where
D: RefUnwindSafe,
C: RefUnwindSafe,
impl<C, D> Send for HashTable<C, D>
impl<C, D> Sync for HashTable<C, D>
impl<C, D> Unpin for HashTable<C, D>
impl<C, D> UnwindSafe for HashTable<C, D>where
D: UnwindSafe,
C: 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
Mutably borrows from an owned value. Read more