shifted_vec

Crates.ioshifted_vec
lib.rsshifted_vec
version0.1.2
sourcesrc
created_at2020-06-08 14:56:51.507037
updated_at2020-06-08 15:09:52.526343
descriptionA growable datastructure with positive and negative indexing built on top of `std::vec::Vec` calculating the offset automatically.
homepagehttps://gitlab.com/dns2utf8/shifted_vec
repositoryhttps://gitlab.com/dns2utf8/shifted_vec
max_upload_size
id251394
size24,747
Stefan Schindler (dns2utf8)

documentation

https://docs.rs/shifted_vec

README

shifted_vec

crates.io docs.rs CI pipeline

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]);
Commit count: 6

cargo fmt