Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- use std::collections::HashMap;
- fn basic_hash_map_ops() {
- let mut scores = HashMap::new();
- // let mut scores = HashMap<String, HashMap<U32, u32>>::new();
- let mut blue :HashMap<u32, u32> = HashMap::new();
- let mut yellow = HashMap::new();
- let mut green = HashMap::new();
- blue.insert(5, 45);
- yellow.insert(6, 54);
- green.insert(7, 63);
- // scores.insert(String::from("Blue"), blue);
- scores.insert("Blue".to_string(), blue);
- scores.entry(String::from("Yellow")).or_insert(yellow);
- scores.entry(String::from("Green")).or_insert(green);
- if let Some(y) = scores.get_mut("Yellow") {
- y.insert(8, 72);
- // println!("{:?}", x);
- }
- println!("{:?}", scores);
- }
- fn setting_structs() {
- struct
- }
- fn main() {
- basic_hash_map_ops();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement