The Dastardly Hashmap @BoxyUwU
fn main() {
let mut map = HashMap::new();
map.insert(1, 2);
assert_eq!(map.get_mut(&1), Some(&mut 2));
}
Solution
error[E0433]: failed to resolve: use of undeclared type `HashMap`
--> examples/misc_4.rs:2:19
|
2 | let mut map = HashMap::new();
| ^^^^^^^ use of undeclared type `HashMap`
|
help: consider importing this struct
|
1 + use std::collections::HashMap;
|
For more information about this error, try `rustc --explain E0433`.
error: could not compile `code` (example "misc_4") due to 1 previous error
Dastardly...
HashMap is not included in the prelude and so must be imported explicitly.