Rust theorytheory 0/50 · 0%
Collections · easy

16. Vectors

Growable arrays.

`Vec<T>` stores elements contiguously on the heap with a length and capacity. push may reallocate; `with_capacity` avoids repeated growth. Indexing panics out of bounds while `get` returns an Option.

Check your understanding

  1. 1. Which access returns Option?

  2. 2. What does with_capacity avoid?