Struct HashTable

Source
#[repr(C)]
pub struct HashTable<K: Hash + PartialEq + Copy + Clone + Default + Pod + Zeroable, V: Default + Copy + Clone + Pod + Zeroable, const NUM_BUCKETS: usize, const MAX_SIZE: usize> { pub buckets: [u32; NUM_BUCKETS], pub allocator: NodeAllocator<HashNode<K, V>, MAX_SIZE, 4>, }

Fields§

§buckets: [u32; NUM_BUCKETS]§allocator: NodeAllocator<HashNode<K, V>, MAX_SIZE, 4>

Implementations§

Source§

impl<K: Hash + PartialEq + Copy + Clone + Default + Pod + Zeroable, V: Default + Copy + Clone + Pod + Zeroable, const NUM_BUCKETS: usize, const MAX_SIZE: usize> HashTable<K, V, NUM_BUCKETS, MAX_SIZE>

Source

pub fn initialize(&mut self)

Source

pub fn new() -> Self

Source

pub fn get_next(&self, index: u32) -> u32

Source

pub fn get_prev(&self, index: u32) -> u32

Source

pub fn get_node(&self, index: u32) -> &HashNode<K, V>

Source

pub fn get_node_mut(&mut self, index: u32) -> &mut HashNode<K, V>

Source

pub fn _remove(&mut self, key: &K) -> Option<V>

Source

pub fn contains(&self, key: &K) -> bool

Source

pub fn get_addr(&self, key: &K) -> u32

Trait Implementations§

Source§

impl<K: Clone + Hash + PartialEq + Copy + Clone + Default + Pod + Zeroable, V: Clone + Default + Copy + Clone + Pod + Zeroable, const NUM_BUCKETS: usize, const MAX_SIZE: usize> Clone for HashTable<K, V, NUM_BUCKETS, MAX_SIZE>

Source§

fn clone(&self) -> HashTable<K, V, NUM_BUCKETS, MAX_SIZE>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<K: Hash + PartialEq + Copy + Clone + Default + Pod + Zeroable, V: Default + Copy + Clone + Pod + Zeroable, const NUM_BUCKETS: usize, const MAX_SIZE: usize> Default for HashTable<K, V, NUM_BUCKETS, MAX_SIZE>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<K: Hash + PartialEq + Copy + Clone + Default + Pod + Zeroable, V: Default + Copy + Clone + Pod + Zeroable, const NUM_BUCKETS: usize, const MAX_SIZE: usize> FromSlice for HashTable<K, V, NUM_BUCKETS, MAX_SIZE>

Source§

fn new_from_slice(slice: &mut [u8]) -> &mut Self

Source§

impl<K: Hash + PartialEq + Copy + Clone + Default + Pod + Zeroable, V: Default + Copy + Clone + Pod + Zeroable, const NUM_BUCKETS: usize, const MAX_SIZE: usize> Index<&K> for HashTable<K, V, NUM_BUCKETS, MAX_SIZE>

Source§

type Output = V

The returned type after indexing.
Source§

fn index(&self, index: &K) -> &Self::Output

Performs the indexing (container[index]) operation. Read more
Source§

impl<K: Hash + PartialEq + Copy + Clone + Default + Pod + Zeroable, V: Default + Copy + Clone + Pod + Zeroable, const NUM_BUCKETS: usize, const MAX_SIZE: usize> IndexMut<&K> for HashTable<K, V, NUM_BUCKETS, MAX_SIZE>

Source§

fn index_mut(&mut self, index: &K) -> &mut Self::Output

Performs the mutable indexing (container[index]) operation. Read more
Source§

impl<'a, K: Hash + PartialEq + Copy + Clone + Default + Pod + Zeroable, V: Default + Copy + Clone + Pod + Zeroable, const NUM_BUCKETS: usize, const MAX_SIZE: usize> IntoIterator for &'a HashTable<K, V, NUM_BUCKETS, MAX_SIZE>

Source§

type Item = (&'a K, &'a V)

The type of the elements being iterated over.
Source§

type IntoIter = HashTableIterator<'a, K, V, NUM_BUCKETS, MAX_SIZE>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
Source§

impl<'a, K: Hash + PartialEq + Copy + Clone + Default + Pod + Zeroable, V: Default + Copy + Clone + Pod + Zeroable, const NUM_BUCKETS: usize, const MAX_SIZE: usize> IntoIterator for &'a mut HashTable<K, V, NUM_BUCKETS, MAX_SIZE>

Source§

type Item = (&'a K, &'a mut V)

The type of the elements being iterated over.
Source§

type IntoIter = HashTableIteratorMut<'a, K, V, NUM_BUCKETS, MAX_SIZE>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
Source§

impl<K: Hash + PartialEq + Copy + Clone + Default + Pod + Zeroable, V: Default + Copy + Clone + Pod + Zeroable, const NUM_BUCKETS: usize, const MAX_SIZE: usize> NodeAllocatorMap<K, V> for HashTable<K, V, NUM_BUCKETS, MAX_SIZE>

Source§

fn insert(&mut self, key: K, value: V) -> Option<u32>

Source§

fn remove(&mut self, key: &K) -> Option<V>

Source§

fn contains(&self, key: &K) -> bool

Source§

fn get(&self, key: &K) -> Option<&V>

Source§

fn get_mut(&mut self, key: &K) -> Option<&mut V>

Source§

fn size(&self) -> usize

👎Deprecated
Source§

fn len(&self) -> usize

Source§

fn capacity(&self) -> usize

Source§

fn iter(&self) -> Box<dyn DoubleEndedIterator<Item = (&K, &V)> + '_>

Source§

fn iter_mut(&mut self) -> Box<dyn DoubleEndedIterator<Item = (&K, &mut V)> + '_>

Source§

fn is_empty(&self) -> bool

Source§

impl<K: Hash + PartialEq + Copy + Clone + Default + Pod + Zeroable, V: Default + Copy + Clone + Pod + Zeroable, const NUM_BUCKETS: usize, const MAX_SIZE: usize> ZeroCopy for HashTable<K, V, NUM_BUCKETS, MAX_SIZE>

Source§

fn load_mut_bytes(data: &mut [u8]) -> Option<&mut Self>

Source§

fn load_bytes(data: &[u8]) -> Option<&Self>

Source§

impl<K: Hash + PartialEq + Copy + Clone + Default + Pod + Zeroable, V: Default + Copy + Clone + Pod + Zeroable, const NUM_BUCKETS: usize, const MAX_SIZE: usize> Zeroable for HashTable<K, V, NUM_BUCKETS, MAX_SIZE>

Source§

fn zeroed() -> Self

Source§

impl<K: Copy + Hash + PartialEq + Copy + Clone + Default + Pod + Zeroable, V: Copy + Default + Copy + Clone + Pod + Zeroable, const NUM_BUCKETS: usize, const MAX_SIZE: usize> Copy for HashTable<K, V, NUM_BUCKETS, MAX_SIZE>

Source§

impl<K: Hash + PartialEq + Copy + Clone + Default + Pod + Zeroable, V: Default + Copy + Clone + Pod + Zeroable, const NUM_BUCKETS: usize, const MAX_SIZE: usize> Pod for HashTable<K, V, NUM_BUCKETS, MAX_SIZE>

Auto Trait Implementations§

§

impl<K, V, const NUM_BUCKETS: usize, const MAX_SIZE: usize> Freeze for HashTable<K, V, NUM_BUCKETS, MAX_SIZE>
where K: Freeze, V: Freeze,

§

impl<K, V, const NUM_BUCKETS: usize, const MAX_SIZE: usize> RefUnwindSafe for HashTable<K, V, NUM_BUCKETS, MAX_SIZE>

§

impl<K, V, const NUM_BUCKETS: usize, const MAX_SIZE: usize> Send for HashTable<K, V, NUM_BUCKETS, MAX_SIZE>
where K: Send, V: Send,

§

impl<K, V, const NUM_BUCKETS: usize, const MAX_SIZE: usize> Sync for HashTable<K, V, NUM_BUCKETS, MAX_SIZE>
where K: Sync, V: Sync,

§

impl<K, V, const NUM_BUCKETS: usize, const MAX_SIZE: usize> Unpin for HashTable<K, V, NUM_BUCKETS, MAX_SIZE>
where K: Unpin, V: Unpin,

§

impl<K, V, const NUM_BUCKETS: usize, const MAX_SIZE: usize> UnwindSafe for HashTable<K, V, NUM_BUCKETS, MAX_SIZE>
where K: UnwindSafe, V: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CheckedBitPattern for T
where T: AnyBitPattern,

Source§

type Bits = T

Self must have the same layout as the specified Bits except for the possible invalid bit patterns being checked during is_valid_bit_pattern.
Source§

fn is_valid_bit_pattern(_bits: &T) -> bool

If this function returns true, then it must be valid to reinterpret bits as &Self.
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> AnyBitPattern for T
where T: Pod,

Source§

impl<T> NoUninit for T
where T: Pod,