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():

fn main() { let xs: Vec<i32> = Vec::new(); }
let xs: Vec<i32> = Vec::new();

Using the vec! macro:

fn main() { let ys: Vec<i32> = vec![]; let zs = vec![1i32, 2, 3, 4, 5]; }
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 &Vec<T> reference via Deref.

Drain

An iterator that drains a vector.

IntoIter

An iterator that moves out of a vector.

Vec

A growable list type, written Vec<T> but pronounced 'vector.'

Functions

as_vec

Convert a slice to a wrapper type providing a &Vec<T> reference.

Type Definitions

instead'>CowVec