dbsp/
hash.rs

1
2
3
4
5
6
7
8
9
10
11
//! Hashing utilities.

use std::hash::{Hash, Hasher};
use xxhash_rust::xxh3::Xxh3Default;

/// Default hashing function used to shard records across workers.
pub fn default_hash<T: Hash + ?Sized>(x: &T) -> u64 {
    let mut hasher = Xxh3Default::new();
    x.hash(&mut hasher);
    hasher.finish()
}