Hi,
I have a struct that looks like this:
struct SomeWrapper {
hmap: HashMap<usize, HashSet<usize>>,
}
I also have this:
impl SomeWrapper {
pub fn from_range(range: std::ops::Range<usize>) -> SomeWrapper {
SomeWrapper {
hmap: range.map(|x| (x, HashSet::new())).collect()
}
}
}
Rust's default hashing function is too slow for my purposes. I already did my research and I can make Rust use a custom Hash Function (type HashMapSea<K, V> = HashMap<K, V, BuildHasherDefault<SeaHasher>>;
and then using that as the new type), but what I really want is to be able to pass a custom hash function from the outside and use that then. I want this to be able to test different hash functions.
Also, since the methods new
and with_capacity
aren't available with a custom hash function, how do I emulate that?
Would be glad if someone could help!