Rust中的哈希Map

严谨!

fn main() {
    use std::collections::HashMap;

    let mut scores = HashMap::new();

    scores.insert(String::from("Blue"), 10);
    scores.insert(String::from("Yellow"), 50);

    for (key, value) in &scores {
    println!("{}: {}", key, value);
    }
}

猜你喜欢

转载自www.cnblogs.com/aguncn/p/11405470.html