According to the Rust documentation:
Vectors always allocate their data on the heap.
As I understand it, this means that:
- Rust allocates enough memory on the heap to keep the type
Tcontiguous. - Rust will not individually place elements, since they are placed in a vector.
In other words, if I add several integers to the vector, and Vecallocates enough storage to store these integers, it will also not insert these integers; introducing another layer of indirection.
I'm not sure how I can illustrate or confirm this with code examples, but any help would be appreciated.
source
share