A collection type holds some number of values (elements) that are all the same type. The standard library offers a number of versatile collection types, such as Vec and HashMap.
All such collection types are built on top of the array primitive types, whose elements are co-located in memory and are individually accessed using an integer index:
- Array types. An array has a statically known size.
- Array reference types. An array reference points to some runtime-determined number of elements of the same type. An array reference may point to some region-allocated array or may be a slice that points to some subset of the elements in an array.