Path: blob/main/crates/polars-core/src/hashing/identity.rs
6940 views
use super::*;12#[derive(Default)]3pub struct IdHasher {4hash: u64,5}67impl Hasher for IdHasher {8fn finish(&self) -> u64 {9self.hash10}1112fn write(&mut self, _bytes: &[u8]) {13unreachable!("IdHasher should only be used for integer keys <= 64 bit precision")14}1516fn write_u32(&mut self, i: u32) {17self.hash = i as u64;18}1920#[inline]21fn write_u64(&mut self, i: u64) {22self.hash = i;23}2425fn write_i32(&mut self, i: i32) {26self.hash = i as u64;27}2829fn write_i64(&mut self, i: i64) {30self.hash = i as u64;31}32}3334pub type IdBuildHasher = BuildHasherDefault<IdHasher>;353637