Closed
Description
Motivation
The current implementation of Vec::remove(idx)
panics if the element at idx
is not present. Vec::try_remove(idx)
checks if the element at idx
exists; If it does, it returns the element as Some(T)
; otherwise it returns None
. This can be helpful when a panic is expected while removing an element from a given idx
.
About tracking issues
Tracking issues are used to record the overall progress of implementation.
They are also used as hubs connecting to other relevant issues, e.g., bugs or open design questions.
A tracking issue is however not meant for large scale discussion, questions, or bug reports about a feature.
Instead, open a dedicated issue for the specific matter and add the relevant feature gate label.
Tasks
- Initial implementation (Add
try_remove
toVec
#77480)- Implement
try_remove
- Re-implement
remove
in terms oftry_remove
- Add tests
- Implement
- Adjust documentation
- Stabilization PR