Tuples as keys of a HashMap



examples/hashes/tuples-as-keys/src/main.rs
use std::collections::HashMap;

fn main() {
    let mut lookup = HashMap::new();
    let a = ("Foo", 2);
    lookup.insert(a, 4);

    lookup.insert(("Bar", 4), 6);

    // The key must be of the same type
    // lookup.insert(("Other", 5, 6), 7);

    println!("{:?}", lookup);
}

{("Foo", 2): 4, ("Bar", 4): 6}