Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Integers as keys of a HashMap

use std::collections::HashMap;

fn main() {
    let mut lookup = HashMap::new();
    lookup.insert(0, "Sunday");
    lookup.insert(1, "Monday");
    lookup.insert(2, "Tuesday");

    println!("{:?}", lookup);
}
{0: "Sunday", 1: "Monday", 2: "Tuesday"}