Module std::vecStable
[-] [+]
[src]
A growable list type with heap-allocated contents, written Vec<T>
but pronounced 'vector.'
Vectors have O(1)
indexing, push (to the end) and pop (from the end).
Examples
Explicitly creating a Vec<T>
with new()
:
let xs: Vec<i32> = Vec::new();
Using the vec!
macro:
let ys: Vec<i32> = vec![]; let zs = vec![1i32, 2, 3, 4, 5];
Push:
fn main() { let mut xs = vec![1i32, 2]; xs.push(3); }let mut xs = vec![1i32, 2]; xs.push(3);
And pop:
fn main() { let mut xs = vec![1i32, 2]; let two = xs.pop(); }let mut xs = vec![1i32, 2]; let two = xs.pop();
Structs
DerefVec | Wrapper type providing a |
Drain | An iterator that drains a vector. |
IntoIter | An iterator that moves out of a vector. |
Vec | A growable list type, written |
Functions
as_vec | Convert a slice to a wrapper type providing a |
Type Definitions
instead'>CowVec |