summaryrefslogtreecommitdiff
path: root/src/collections.rs
blob: fa9e3fa7c92dfa4e1eb4456b4e8dd591886f623a (plain)
1
2
3
4
5
6
7
8
9
10
use ahash::AHasher;
use std::hash::BuildHasherDefault;

/// DOS attacks aren't a concern for Rustlings. Therefore, we use `ahash` with fixed seeds.
pub type HashSet<T> = std::collections::HashSet<T, BuildHasherDefault<AHasher>>;

#[inline]
pub fn hash_set_with_capacity<T>(capacity: usize) -> HashSet<T> {
    HashSet::with_capacity_and_hasher(capacity, BuildHasherDefault::<AHasher>::default())
}