Multi delete and insert for vec


I recently wrote ommap, an ordered multivalue map based on the vec datastructure.

The next feature i want to implement is a bulk deletition, a bulk insertion and especially both at once for reducing the ammount of shifting elements in such a situation. How should I implement this kind of algorithm? Or should I use another datastructure then vec as basis?


I just tried myself and feel quite confident with my first attempt:

Its still all based on vec and highly inspired by its retain method. I think I will be able to adopt this
approach to both other cases.