capacity
How much space a String or Vec has reserved, used or not.
Capacity is the number of elements (bytes for String) a buffer can hold before it must reallocate.
Loading interactive…
Examples
String::with_capacity(10)starts withlen()0 andcapacity()10: room is reserved, nothing is stored yet.
See also