Type Alias HashSet

Source
pub type HashSet<T> = HashSet<T, BuildHasherDefault<XxHash64>>;
Expand description

Alias of std::collections::HashSet with RandomState replaced by a deterministic default hasher XxHash64. Determinism is important during composition rendering for reproducibility with seeds.

Unfortunately, with a different hasher, some of the convenience constructors such as HashSet::new and HashSet::from are lost. Here are some suggestions however:

// To get a new empty HashSet
let set: HashSet<String> = HashSet::default();
assert!(set.is_empty());

// To initialize with an array
let set = ["val1", "val2"].into_iter().collect::<HashSet<_>>();
assert!(set.contains("val1"));
assert!(set.contains("val2"));

Aliased Typeยง

pub struct HashSet<T> { /* private fields */ }