toml
toml copied to clipboard
No `retain` for `Array` and `Table`/`TableLike`
It's currently pretty painful to remove items matching a given condition from an array or table with toml_edit due to the lack of a retain-like method. You need one "pass" to gather the indices, and clone them if removing from a table, and then a second pass to remove each one, one by one. This is both unergonomic and inefficient. It'd be great to have Array::retain and TableLike::retain to make this kind of "match removal" easier!
Agreed though right now I won't be able to get to this as I'm focused on prep work for cargo-add going into cargo. Contributions would be welcome!
Love you both so I did #575.
retain should already be available to Array because it's a type alias to Vec :) .
Unlinking #575 to this issue because I did it for the wrong crate :laughing:, I might try again for the right one :sweat_smile: .
@epage you can close this due to #576.
(I now realize that "Solves" isn't a recognized keyword for linking a PR to an issue.)