Rust HashMap Manipulation
Some Rust HashMap examples, using get, match, and finding by key and by value.
Example code is provided at the Rust Playground for you to try out:
https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=3a2b4caa8ef8bfe616794f802eb11376 https://gist.github.com/3a2b4caa8ef8bfe616794f802eb11376
use std::collections::HashMap;
fn main() {
    let mut myhm:HashMap<String, String> = HashMap::new();
    myhm.insert("Bob".to_string(),"32".to_string());
    myhm.insert("Rob".to_string(),"38".to_string());
    myhm.insert("Zob".to_string(),"46".to_string());
    if myhm.contains_key("Bob"){
        println!("{}","Bob IS in the HashMap")
    }
    //println!("{:?}",myhm.get("Bkob"));
    match myhm.get("Bob"){
        Some(abc)=>println!("Age: {}", abc),
        None => println!("Bob is NOT found")
    };
    for (k,v) in myhm{
        if k =="Bob"{
            println!("Found Bob his age is {:?}\n",v)
        }
    };
}
  
