Struct sokoban::hash_table::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>
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>
pub fn initialize(&mut self)
pub fn new() -> Self
pub fn get_next(&self, index: u32) -> u32
pub fn get_prev(&self, index: u32) -> u32
pub fn get_node(&self, index: u32) -> &HashNode<K, V>
pub fn get_node_mut(&mut self, index: u32) -> &mut HashNode<K, V>
pub fn _remove(&mut self, key: &K) -> Option<V>
pub fn contains(&self, key: &K) -> bool
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>
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§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>
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§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>
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>
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>
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§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>
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§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>
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§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>
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§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>
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>
fn insert(&mut self, key: K, value: V) -> Option<u32>
fn remove(&mut self, key: &K) -> Option<V>
fn contains(&self, key: &K) -> bool
fn get(&self, key: &K) -> Option<&V>
fn get_mut(&mut self, key: &K) -> Option<&mut V>
fn len(&self) -> usize
fn capacity(&self) -> usize
fn iter(&self) -> Box<dyn DoubleEndedIterator<Item = (&K, &V)> + '_>
fn iter_mut(&mut self) -> Box<dyn DoubleEndedIterator<Item = (&K, &mut V)> + '_>
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>
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§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>
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>
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>
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> RefUnwindSafe for HashTable<K, V, NUM_BUCKETS, MAX_SIZE>where K: RefUnwindSafe, V: RefUnwindSafe,
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> CheckedBitPattern for Twhere
T: AnyBitPattern,
impl<T> CheckedBitPattern for Twhere T: AnyBitPattern,
§type Bits = T
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
fn is_valid_bit_pattern(_bits: &T) -> bool
If this function returns true, then it must be valid to reinterpret
bits
as &Self
.