-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Add a range argument to vec.extract_if #133265
base: master
Are you sure you want to change the base?
Conversation
This comment has been minimized.
This comment has been minimized.
/// ``` | ||
/// #![feature(extract_if)] | ||
/// let mut items = vec![0, 0, 0, 0, 0, 0, 0, 1, 2, 1, 2, 1, 2]; | ||
/// let ones = items.extract_if(7.., |x| *x == 1).collect::<Vec<_>>(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe change one of the first few 0
s to 1
to indicate they don't get extracted (out of range)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hrm, I wanted to show the "I have a prefix that I know doesn't contain those things, so I can skip them" use.
34ed582
to
0076504
Compare
This comment has been minimized.
This comment has been minimized.
0076504
to
d8ce784
Compare
This comment has been minimized.
This comment has been minimized.
since drain-on-drop behavior was removed those bounds no longer serve a purpose
5d0e0a7
to
aabed33
Compare
tracking issue: #43244
This adds the range argument requested in #43244 (comment)