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
.
Contribute to Docs
- Learn more about how to get involved.
- Edit this page on GitHub to fix an error or make an improvement.
- Submit feedback to let us know how we can improve Docs.
Learn Rust on Codecademy
- Career path
Computer Science
Looking for an introduction to the theory behind programming? Master Python while learning data structures, algorithms, and more!Includes 6 CoursesWith Professional CertificationBeginner Friendly75 hours - Free course
Rust for Programmers
A quick primer on the fundamentals of the Rust programming language for experienced programmers.Intermediate1 hour