Struct default_vec::DefaultVec
[−]
[src]
pub struct DefaultVec<T: Default> { /* fields omitted */ }
A vector with a default value. All uninitialized values are set to T::default().
Methods
impl<T: Default> DefaultVec<T>[src]
fn new() -> Self[src]
Creates an empty vector.
fn with_capacity(cap: usize) -> Self[src]
Creates an empty vector with capacity for cap values.
fn capacity(&self) -> usize[src]
Returns the total number of values the vector stores.
fn resize(&mut self, new_cap: usize)[src]
Resizes the vector to contain at least new_cap values.
fn get(&self, idx: usize) -> &T[src]
Get a reference to the value in position idx, panicking if the index is out of bounds.
fn get_mut(&mut self, idx: usize) -> &mut T[src]
Get a reference to the value in position idx, resizing if the index is out of bounds.
fn insert(&mut self, idx: usize, val: T) -> T[src]
Inserts a value into the vector, returning the old value.
fn remove(&mut self, idx: usize) -> T[src]
Removes a value from the vector.
fn find<F: FnMut(&T) -> bool>(&self, start: usize, pred: F) -> usize[src]
Starting from start, check each value in the vector and returns the index of the first one
that satisfies it, or capacity() if none is found.