no function or associated item named new found for type std::collections::HashMap<_, _, std::hash::BuildHasherDefault<fxhash::FxHasher>> in the current scope
--> src/main.rs:2:5
|
2 | fxhash::FxHashMap::new();
| ^^^^^^^^^^^^^^^^^^^^^^ function or associated item not found in std::collections::HashMap<_, _, std::hash::BuildHasherDefault<fxhash::FxHasher>>
Neither the error, nor the crate's docs say anything about any extra traits or other methods needed to use it.
Did it work? Is the crate broken? Has stdlib changed?
FxHashMap<K, V> is simply an alias for HashMap<K, V, FxBuildHasher>. The new function is only implemented for HashMap's with the default std::collections::hash_map::RandomState hasher builder. Therefore it can't be used with FxHashMap which uses FxBuildHasher (source).
A HashMap with an arbitrary hasher can be created using the default method instead.