use std::collections::HashMap; let mut scores = HashMap::new(); scores.insert(String::from("Alice"), 95); scores.entry(String::from("Alice")).or_insert(0); scores.entry(String::from("Bob")).or_insert(0); println!("{:?}", scores); // {"Alice": 95, "Bob": 0}