| Crates.io | shifted_vec |
| lib.rs | shifted_vec |
| version | 0.1.2 |
| created_at | 2020-06-08 14:56:51.507037+00 |
| updated_at | 2020-06-08 15:09:52.526343+00 |
| description | A growable datastructure with positive and negative indexing built on top of `std::vec::Vec` calculating the offset automatically. |
| homepage | https://gitlab.com/dns2utf8/shifted_vec |
| repository | https://gitlab.com/dns2utf8/shifted_vec |
| max_upload_size | |
| id | 251394 |
| size | 24,747 |
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]);