scanmut
Insert or remove multiple elements from a Vec in O(n) time.
This crate provides two types for versatile and efficient Vec mutation; Inserter and
Remover. These two types can be seen as more generic implementations of Vec::insert and
Vec::drain, allowing you to for example efficiently insert a slice, conditionally drain
elements, or access elements of a Vec while draining from it.
Inserter and Remover requires an ordering of the insert and removal indices; monotonically
non-increasing for Inserter and monotonically increasing for Remover.
For convenience, there are also extension traits adding common higher level operations using the
Inserter and Remover. See ScanMut, InsertSliceClone, and InsertSliceCopy.
Examples
Inserting a slice into a vec using [ScanMut::insert_all]:
use *;
let mut v = vec!;
v.insert_all;
assert_eq!;
Removing multiple elements in one scan using [ScanMut::multi_remove]:
use *;
let mut v = vec!;
v.multi_remove;
assert_eq!;
License: MIT