summaryrefslogtreecommitdiff
path: root/src/collections.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/collections.rs')
-rw-r--r--src/collections.rs10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/collections.rs b/src/collections.rs
new file mode 100644
index 0000000..fa9e3fa
--- /dev/null
+++ b/src/collections.rs
@@ -0,0 +1,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())
+}