ds-learn-rust 0.1.1

Code that I wrote while learning Rust from the Rust Book
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
use std::collections::HashMap;

pub fn ch_08_03() {
    let mut hm = HashMap::new();
    hm.insert("foo", 3);
    hm.insert("foo", 10);
    hm.insert("bar", 4);
    for (key, value) in &hm {
        println!("{} {}", key, value);
    }
    let count = hm.entry("non-existent").or_insert(99);
    *count += 3;
    println!("{:?}", hm.entry("foo").or_insert(99));
    println!("{:?}", hm);
}