orxfun / orx-split-vec

An efficient constant access time vector with dynamic capacity and pinned elements.
https://crates.io/crates/orx-split-vec
MIT License
2 stars 2 forks source link

unsafe `set_len` breaks fragmentation rules #58

Open orxfun opened 1 month ago

orxfun commented 1 month ago

Assume we are using a Doubling strategy and currently we have 2 fragments with capacities of 4 an 8 respectively. If the user calls set_len(3) while the vector is on this state, we will have:

This is an invalid fragment state. We must drop the second fragment.