slotmapvec

Crates.ioslotmapvec
lib.rsslotmapvec
version0.1.3
sourcesrc
created_at2018-03-09 14:59:11.583963
updated_at2018-10-28 07:30:45.544755
descriptionDeprecated: use slotmap
homepagehttps://github.com/luteberget/slotmapvec-rs
repositoryhttps://github.com/luteberget/slotmapvec-rs
max_upload_size
id54690
size16,371
Bjørnar Steinnes Luteberget (luteberget)

documentation

README

Deprecated: use slotmap.

Slot map: array storage with persistent indices

Vec<T>-like collection with stable indices. The underlying array's indices are re-used by incrementing a versioning tag in the index type.

The SlotMapIndex type consists of a u32 for storing the index into the underlying array, and a u32 for storing the version. Deleting and inserting more times than the maximum value of u32 will cause overflow and index conflict bugs.

Example

# use slotmapvec::*;
let mut map = SlotMapVec::new();

map.insert(123213);
let idx = map.insert(34234);
map.insert(654654);

map.remove(idx);
let idx2 = map.insert(999);
assert_eq!(map.get(idx), None);
assert_eq!(map.get(idx2), Some(&999));
Commit count: 13

cargo fmt