Vector
It’s the most commonly used collection.
let mut v: Vec<i32> = Vec::new();
v.push(2);
v.push(4);
v.push(6);
let x = v.pop(); // x is 6
println!("{}", v[1]); // prints "4"
You can also create a vector much more ergonomic, like this:
let mut v = vec![2, 4, 6];
Vectors have a ton of methods.
HashMap<K, V>
In other languages, you can call it a dictionary.
let mut h: HashMap<u8, bool> = HashMap::new();
h.insert(2, true);
h.insert(7, false);
You must specify a type of Key and a type of Value.
There are a bunch of other collections: VecDeque, HashSet, LinkedList, BinaryHeap, BTreeMap, BTreeSet. You can read about them in Rust docs. I use them rarely, so I don’t want to waste time here to describe each of them.