#stable #index #element #insertion #indices #vector #vec

general_stable_vec

A Vec implementation with stable indices

16 releases (10 breaking)

0.11.1 Apr 21, 2024
0.10.1 Apr 15, 2024
0.4.0 Mar 28, 2024

#621 in Algorithms

Download history 304/week @ 2024-03-20 311/week @ 2024-03-27 372/week @ 2024-04-03 328/week @ 2024-04-10 351/week @ 2024-04-17 20/week @ 2024-04-24 2/week @ 2024-05-01

706 downloads per month

BSD-2-Clause

20KB
373 lines

General Stable Vec

A stable vector implementation that allows insertions and deletions in amortised O(1), and uses memory linear in the maximum number of elements that the vector contained.

A stable vector is a vector that keeps its indices stable, i.e. the index of an element is assigned upon insertion and not changed until removal. This works much like a hash map, except that in this implementation, the index is assigned by the stable vector, and cannot be chosen by the user.


lib.rs:

A general stable vector implementation.

A stable vector is a vector for which each inserted element keeps its index until it is removed.

Dependencies

~310–770KB
~18K SLoC