pub trait VecWithPositions<'a, T> {
type Positions: Iterator<Item = &'a usize> + 'a;
type PositionsMut: Iterator<Item = &'a mut usize> + 'a;
Show 15 methods
// Required methods
fn vec(&self) -> &Vec<T>;
fn vec_mut(&mut self) -> &mut Vec<T>;
fn positions(&'a self) -> Self::Positions;
fn positions_mut(&'a mut self) -> Self::PositionsMut;
// Provided methods
fn push(&mut self, value: T) { ... }
fn append(&mut self, other: &mut Vec<T>) { ... }
fn remove(&'a mut self, index: usize) -> T { ... }
fn clear(&mut self) { ... }
fn get(&self, index: usize) -> Option<&T> { ... }
fn get_mut(&mut self, index: usize) -> Option<&mut T> { ... }
fn set(&mut self, index: usize, value: T) { ... }
fn is_empty(&self) -> bool { ... }
fn len(&self) -> usize { ... }
fn iter(&'a self) -> Iter<'a, T> { ... }
fn iter_mut(&'a mut self) -> IterMut<'a, T> { ... }
}Expand description
A Vec inside together with positions that move together with the elements if the Vec
has deletions or insertions.
Implemented partially.
TODO: Position enum type to differentiate positions and indexes.