Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No retain for Array and Table/TableLike #311

Closed
jonhoo opened this issue Mar 4, 2022 · 4 comments
Closed

No retain for Array and Table/TableLike #311

jonhoo opened this issue Mar 4, 2022 · 4 comments
Labels
A-edit Area: TOML editing API C-enhancement Category: Raise on the bar on expectations

Comments

@jonhoo
Copy link
Contributor

jonhoo commented Mar 4, 2022

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!

@epage epage added the C-enhancement Category: Raise on the bar on expectations label Mar 4, 2022
@epage
Copy link
Member

epage commented Mar 4, 2022

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!

@epage epage added the A-edit Area: TOML editing API label Jan 18, 2023
@marcospb19
Copy link
Contributor

Love you both so I did #575.

retain should already be available to Array because it's a type alias to Vec :) .

@marcospb19
Copy link
Contributor

Unlinking #575 to this issue because I did it for the wrong crate 😆, I might try again for the right one 😅 .

@marcospb19
Copy link
Contributor

marcospb19 commented Jul 5, 2023

@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.)

@epage epage closed this as completed Jul 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-edit Area: TOML editing API C-enhancement Category: Raise on the bar on expectations
Projects
None yet
Development

No branches or pull requests

3 participants