VecWithPositions

Trait VecWithPositions 

Source
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.

Required Associated Types§

Source

type Positions: Iterator<Item = &'a usize> + 'a

Source

type PositionsMut: Iterator<Item = &'a mut usize> + 'a

Required Methods§

Source

fn vec(&self) -> &Vec<T>

Source

fn vec_mut(&mut self) -> &mut Vec<T>

Source

fn positions(&'a self) -> Self::Positions

Source

fn positions_mut(&'a mut self) -> Self::PositionsMut

Provided Methods§

Source

fn push(&mut self, value: T)

Source

fn append(&mut self, other: &mut Vec<T>)

Source

fn remove(&'a mut self, index: usize) -> T

Source

fn clear(&mut self)

Source

fn get(&self, index: usize) -> Option<&T>

Source

fn get_mut(&mut self, index: usize) -> Option<&mut T>

Source

fn set(&mut self, index: usize, value: T)

Source

fn is_empty(&self) -> bool

Source

fn len(&self) -> usize

Source

fn iter(&'a self) -> Iter<'a, T>

Source

fn iter_mut(&'a mut self) -> IterMut<'a, T>

Implementors§