rustlings/src/collections.rs

10 lines
344 B
Rust
Raw Normal View History

2024-10-14 09:24:42 -04:00
use foldhash::fast::FixedState;
2024-08-08 17:46:21 -04:00
2024-10-14 09:24:42 -04:00
/// DOS attacks aren't a concern for Rustlings. Therefore, we use `foldhash` with a fixed state.
pub type HashSet<T> = std::collections::HashSet<T, FixedState>;
2024-08-08 17:46:21 -04:00
#[inline]
pub fn hash_set_with_capacity<T>(capacity: usize) -> HashSet<T> {
2024-10-14 09:24:42 -04:00
HashSet::with_capacity_and_hasher(capacity, FixedState::default())
2024-08-08 17:46:21 -04:00
}