0.1.8 Update
Dramatically simplified from a generic SliceMap that supported different storages to a Concrete SliceMap that always uses Vec for values and SlotMap<SliceKey, Range> for slice ranges. This now allows removing slices and the existing Slice Keys remain valid (except for the removed one), thanks to the SlotMap.
[SliceMap] provides a container that allows iterating directly all of its items, or iterating through non-overlapping slices of varying sizes. You can only insert new items in groups that will become a new slice.
Example
A good use would be storing the points for polygons of different point counts, but in a way where all those points are laid out continuously in memory. Each slice is effectively a new polygon, and drawing all polygons at once can be very CPU cache-friendly.
Here's the code for a simpler example with i32 values:
use SliceMap;
let mut slices = default;
// Adding items can fail when using SliceArray and the capacity is reached,
// but is unlikely to fail with SliceVec.
let a = slices.add_items;
let b = slices.add_items;
let c = slices.add_items;
// Iterating over slices
let mut slice_iter = slices.iter_slices;
assert_eq!;
assert_eq!;
assert_eq!;
assert_eq!;
// Iterating over all items
let mut i = 1;
for item in slices.iter_items