Implement VecDeque::retain_mut by GuillaumeGomez · Pull Request #91215 · rust-la...
source link: https://github.com/rust-lang/rust/pull/91215
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
Conversation
This comment has been hidden.
If we add a new variant of retain it would be nice to add a range parameter, it helps in cases where one only wants to work on a sub-section of an vec, e.g. when a callee appended N items then it can be more efficient to only post-filter those items but not the whole vec.
It seems like a completely different feature. You can't have more parameter in retain_mut
than in retain
. Maybe a retain_range
or something along the line?
Sure, the name could be different, but imo not having the range on retain
was simply an oversight since one always could have done retain(.., |foo| {/* condition */})
, so any new method should have it.
In this case &mut
is a more powerful version because a &mut self
is taken of the vec anyway, so if we're making a more powerful version we might as well add the range.
Please open an issue so you can talk about it with libs team and not flood this PR too much.
@bors r+ rollup
Commit 0466a12 has been approved by m-ou-se
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
No reviews
None yet
Successfully merging this pull request may close these issues.
None yet
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK