diff --git a/.proteto/README.md b/.proteto/README.md index b547805..27f4483 100644 --- a/.proteto/README.md +++ b/.proteto/README.md @@ -2,10 +2,10 @@ %% block body Forward scan over a vector with mutation and item removal. -Provides an iterator like interface over a vector which allows mutation and -removal of items. Items are kept in order and every item is moved at most once, -even when items are removed. Dropping the `VecMutScan` mid-iteration keeps -remaining items in the vector. +Provides a `VecMutScan` wrapper for a `Vec` with an iterator like interface +over which also allows mutation and removal of items. Items are kept in order +and every item is moved at most once, even when items are removed. Dropping the +`VecMutScan` mid-iteration keeps remaining items in the vector. This can be seen as an extension of `Vec`'s `retain` and `drain`. It is also very similar to the unstable `drain_filter` but slightly more flexible. Unlike @@ -13,4 +13,8 @@ very similar to the unstable `drain_filter` but slightly more flexible. Unlike elements). It also doesn't require the filtering to be done within a closure, which gives additional flexibilty at the cost of not being able to implement the `Iterator` trait. + +Also provides a `VecGrowScan` wrapper that extends `VecMutScan` to allow +insertions during the iteration. This may require additional item moves and +temporary storage, but still runs in linear time. %% endblock diff --git a/CHANGELOG.md b/CHANGELOG.md index 7647f8a..7f29d74 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## vec_mut_scan 0.4.0 (2021-01-17) + +* Add `VecGrowScan` for arbitrary insertions and removals during iteration (contributed by Jakub Kądziołka) + ## vec_mut_scan 0.3.0 (2020-09-08) * Allow mutable access to all vector elements during iteration diff --git a/Cargo.toml b/Cargo.toml index 96a352a..d0795de 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "vec_mut_scan" -version = "0.3.0" +version = "0.4.0" authors = ["Jannis Harder "] edition = "2018" description = "Forward scan over a vector with mutation and item removal" diff --git a/README.md b/README.md index 216eadc..b9704b8 100644 --- a/README.md +++ b/README.md @@ -7,10 +7,10 @@ Forward scan over a vector with mutation and item removal. -Provides an iterator like interface over a vector which allows mutation and -removal of items. Items are kept in order and every item is moved at most once, -even when items are removed. Dropping the `VecMutScan` mid-iteration keeps -remaining items in the vector. +Provides a `VecMutScan` wrapper for a `Vec` with an iterator like interface +over which also allows mutation and removal of items. Items are kept in order +and every item is moved at most once, even when items are removed. Dropping the +`VecMutScan` mid-iteration keeps remaining items in the vector. This can be seen as an extension of `Vec`'s `retain` and `drain`. It is also very similar to the unstable `drain_filter` but slightly more flexible. Unlike @@ -19,6 +19,10 @@ elements). It also doesn't require the filtering to be done within a closure, which gives additional flexibilty at the cost of not being able to implement the `Iterator` trait. +Also provides a `VecGrowScan` wrapper that extends `VecMutScan` to allow +insertions during the iteration. This may require additional item moves and +temporary storage, but still runs in linear time. + ## License This software is available under the Zero-Clause BSD license, see