pub struct Tab32Mixed { /* private fields */ }Expand description
A hash function for 32-bit integers using mixed tabulation.
Mixed tabulation first hashes the four input bytes into a 32-bit intermediate
hash value and four derived bytes. The derived bytes are then hashed by a
second simple tabulation function and XORed into the intermediate value.
This implementation uses c = d = 4, where c is the number of input
characters and d is the number of derived characters.
Usage:
use tab_hash::Tab32Mixed;
let keys = vec![0, 8, 15, 47, 11];
let mixed = Tab32Mixed::new();
for k in keys {
println!("{}", mixed.hash(k));
}Implementations§
Source§impl Tab32Mixed
impl Tab32Mixed
Sourcepub fn to_vec(&self) -> (Vec<Vec<u64>>, Vec<Vec<u32>>)
pub fn to_vec(&self) -> (Vec<Vec<u64>>, Vec<Vec<u32>>)
Convert the two tables to nested vectors.
Sourcepub fn from_vec(
first_table_data: Vec<Vec<u64>>,
second_table_data: Vec<Vec<u32>>,
) -> Self
pub fn from_vec( first_table_data: Vec<Vec<u64>>, second_table_data: Vec<Vec<u32>>, ) -> Self
Create a mixed tabulation hash function from nested-vector table data.
Sourcepub fn with_table(
first_table: [[u64; 256]; 4],
second_table: [[u32; 256]; 4],
) -> Self
pub fn with_table( first_table: [[u64; 256]; 4], second_table: [[u32; 256]; 4], ) -> Self
Create a mixed tabulation hash function with the given tables.
Trait Implementations§
Source§impl Clone for Tab32Mixed
impl Clone for Tab32Mixed
Source§fn clone(&self) -> Tab32Mixed
fn clone(&self) -> Tab32Mixed
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<'de> Deserialize<'de> for Tab32Mixed
impl<'de> Deserialize<'de> for Tab32Mixed
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for Tab32Mixed
impl RefUnwindSafe for Tab32Mixed
impl Send for Tab32Mixed
impl Sync for Tab32Mixed
impl Unpin for Tab32Mixed
impl UnsafeUnpin for Tab32Mixed
impl UnwindSafe for Tab32Mixed
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