forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit 19a40ec
authored
Rollup merge of rust-lang#123107 - avandesa:vec_pop_if, r=joboet
Implement `Vec::pop_if`
This PR adds `Vec::pop_if` to the public API, behind the `vec_pop_if` feature.
```rust
impl<T> Vec<T> {
pub fn pop_if<F>(&mut self, f: F) -> Option<T>
where F: FnOnce(&mut T) -> bool;
}
```
Tracking issue: rust-lang#122741
## Open questions
- [ ] Should the first unit test be split up?
- [ ] I don't see any guidance on ordering of methods in impl blocks, should I move the method elsewhere?4 files changed
+57
-0
lines changedOriginal file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
170 | 170 |
| |
171 | 171 |
| |
172 | 172 |
| |
173 | + | ||
173 | 174 |
| |
174 | 175 |
| |
175 | 176 |
| |
|
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
2058 | 2058 |
| |
2059 | 2059 |
| |
2060 | 2060 |
| |
2061 | + | ||
2062 | + | ||
2063 | + | ||
2064 | + | ||
2065 | + | ||
2066 | + | ||
2067 | + | ||
2068 | + | ||
2069 | + | ||
2070 | + | ||
2071 | + | ||
2072 | + | ||
2073 | + | ||
2074 | + | ||
2075 | + | ||
2076 | + | ||
2077 | + | ||
2078 | + | ||
2079 | + | ||
2080 | + | ||
2081 | + | ||
2082 | + | ||
2083 | + | ||
2084 | + | ||
2085 | + | ||
2061 | 2086 |
| |
2062 | 2087 |
| |
2063 | 2088 |
| |
|
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
43 | 43 |
| |
44 | 44 |
| |
45 | 45 |
| |
46 | + | ||
46 | 47 |
| |
47 | 48 |
| |
48 | 49 |
| |
|
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
2644 | 2644 |
| |
2645 | 2645 |
| |
2646 | 2646 |
| |
2647 | + | ||
2648 | + | ||
2649 | + | ||
2650 | + | ||
2651 | + | ||
2652 | + | ||
2653 | + | ||
2654 | + | ||
2655 | + | ||
2656 | + | ||
2657 | + | ||
2658 | + | ||
2659 | + | ||
2660 | + | ||
2661 | + | ||
2662 | + | ||
2663 | + | ||
2664 | + | ||
2665 | + | ||
2666 | + | ||
2667 | + | ||
2668 | + | ||
2669 | + | ||
2670 | + | ||
2671 | + | ||
2672 | + | ||
2673 | + | ||
2674 | + | ||
2675 | + | ||
2676 | + | ||
2647 | 2677 |
| |
2648 | 2678 |
| |
2649 | 2679 |
| |
|
0 commit comments