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:

use std::collections::HashMap;

fn main() {

    let mut myhm:HashMap<String, String> = HashMap::new();


    if myhm.contains_key("Bob"){
        println!("{}","Bob IS in the HashMap")


    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)


Previous article

Explore Bitcoin Core

Next article

Traits #1