Collections

Published Mar 6, 2024
Contribute to Docs

In Rust, collections are fundamental data structures offered by the standard library, enabling the storage and manipulation of multiple values. These dynamic structures differ from fixed-size arrays and tuples by allowing a variable number of elements. The key advantage lies in their ability to dynamically allocate memory on the heap, which means that the amount of data does not need to be known at compile time and can shrink and grow during runtime. The most commonly used collection data types include vector, string, and Hashmap. The rest include VecDeque, LinkedList, BTreeMap, set, and BinaryHeap.

All contributors

Looking to contribute?

Learn Rust on Codecademy