Common Collections
Rust’s standard library provides heap-allocated collections that can grow or shrink at runtime. The three most commonly used are:
- Vector (
Vec<T>) - Dynamic arrays for storing values of the same type - String - UTF-8 encoded text collections
- HashMap (
HashMap<K, V>) - Key-value mappings using hash tables
Each collection has different performance characteristics and trade-offs. This chapter covers creation, updating, and reading operations for each type.