How to Use std

:collections: Choosing the Right Collection

Select Vec for ordered lists, String for text, and HashMap for fast key-value lookups in Rust.

Choose Vec<T> for ordered lists, String for text, and HashMap<K, V> for key-value lookups. Use std::collections::HashMap to store and retrieve data by keys.

use std::collections::HashMap;

fn main() {
    let mut scores = HashMap::new();
    scores.insert("blue", 10);
    scores.insert("yellow", 50);
    println!("{:?}", scores);
}