Rust’s standard library includes a number of very useful data structures called collections.
Unlike the built-in array and tuple types, the data these collections point to is stored on the heap, which means the amount of data does not need to be known at compile time and can grow or shrink as the program runs.
String type previously, but in this chapter we’ll talk about it in depth.To learn about the other kinds of collections provided by the standard library, see the documentation.
Vec<T>, also known as a vector.let v: Vec<i32> = Vec::new();
Vec<T> with initial values and Rust will infer the type of value you want to store, so you rarely need to do this type annotation.vec! macro, which will create a new vector that holds the values you give it.
let v = vec![1, 2, 3];