[][src]Crate shifted_vec

A growable datastructure with positive and negative indexing built on top of std::vec::Vec calculating the offset automatically.

use shifted_vec::ShiftedVec;

let mut v = ShiftedVec::with_offset_and_capacity(-2, 5);

// populate the ShiftedVec
v.push(0);
v.push(1);
v.push(2);
v.push(3);
v.push(4);

assert_eq!(5, v.len());

assert_eq!(2, v[0]);

// mutable access with index
v[0] = 5;

assert_eq!(5, v[0]);

Structs

ShiftedIterator

See iter_shifted()

ShiftedIteratorMut

See iter_shifted_mut()

ShiftedVec

Wrapping the std::vec::Vec that keeps track of the offset that can handle any Type