#[repr(C)]pub struct hash_table_state { /* private fields */ }
Expand description
Hash table data structure. This module provides an automatically resizing hash table implementation for general purpose use. The hash table stores a mapping between void * keys and values; it is expected that in most cases, these will point to a structure elsewhere in the heap, instead of inlining a key or value into the hash table element itself.
Currently, this hash table implements a variant of robin hood hashing, but we do not guarantee that this won’t change in the future.
Associated with each hash function are four callbacks:
hash_fn - A hash function from the keys to a uint64_t. It is critical that the hash function for a key does not change while the key is in the hash table; violating this results in undefined behavior. Collisions are tolerated, though naturally with reduced performance.
equals_fn - An equality comparison function. This function must be reflexive and consistent with hash_fn.
destroy_key_fn, destroy_value_fn - Optional callbacks invoked when the table is cleared or cleaned up and at the caller’s option when an element is removed from the table. Either or both may be set to NULL, which has the same effect as a no-op destroy function.
This datastructure can be safely moved between threads, subject to the requirements of the underlying allocator. It is also safe to invoke non-mutating operations on the hash table from multiple threads. A suitable memory barrier must be used when transitioning from single-threaded mutating usage to multithreaded usage.
Trait Implementations
sourceimpl Clone for hash_table_state
impl Clone for hash_table_state
sourcefn clone(&self) -> hash_table_state
fn clone(&self) -> hash_table_state
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more