In Rust we have two built-in ways to store multiple elements in order: arrays and vectors. Each type has its place, but most often we will want to use vectors. Arrays meanwhile can be used for performance optimizations and to reduce memory usage.
An array can store only a fixed number of elements—it cannot be resized. So it might have 10 i32 elements. Meanwhile a vector has a resizable buffer, so it can grow from 0 elements to millions of elements (with each push call).
Vectors tend to be easier to use, but arrays have some advantages:
In places where performance is not critical, vectors are an easier and more convenient choice. They also lead to more resilient code in case more elements than expected are needed. But arrays have an important role in optimization, and can reduce memory usage.