tinyvec
tinyvec copied to clipboard
`drain_filter`
- [ ] ArrayVec
- [ ] TinyVec
Waiting on https://github.com/rust-lang/rust/issues/43244, though we could add this behind a feature gate before that if we like.
You don't strictly need to wait for nightly to do this, for the Vec
side of things (unless the feature is enabled) you could simply use the "manual" version of .drain_filter()
let mut idx = 0;
while idx < vec.get().len() {
if vec[idx] == input {
vec.remove(idx);
} else {
idx += 1;
}
}
In case of TinyVec, drain_filter = partition + drain(partition_point..)