std::vec::Vec API Reference
Rust's Vec<T> — a growable, heap-allocated contiguous sequence. The default collection for owned lists.
Vec<T>
A contiguous growable array type, written Vec<T> but pronounced 'vector'.
Vec::new() -> Vec<T>Constructs a new, empty Vec. The vector will not allocate until elements are pushed onto it.
Returns: Vec<T>
Vec::with_capacity(capacity: usize) -> Vec<T>Constructs a new, empty Vec with at least the specified capacity.
Returns: Vec<T>
vec.push(value: T)Appends an element to the back of a collection.
Returns: ()
vec.pop() -> Option<T>Removes the last element from a vector and returns it, or None if it is empty.
Returns: Option<T>
vec.len() -> usizeReturns the number of elements in the vector, also referred to as its 'length'.
Returns: usize
vec.get(index: usize) -> Option<&T>Returns a reference to an element or subslice depending on the type of index, returning None if out of bounds.
Returns: Option<&T>
vec.iter() -> Iter<T>Returns an iterator that yields references to the elements of the vector in order.
Returns: Iter<T>
vec.extend<I: IntoIterator<Item = T>>(iter: I)Extends a collection with the contents of an iterator.
Returns: ()