Open
Description
Feature gate: #![feature(vec_split_at_spare)]
This is a tracking issue for Vec::split_at_spare_mut
, which is used as the basis for a few methods internally to give a slice pointing to the initialized portion of the Vec
and a slice of MaybeUninit
pointing to the uninitialized portion.
Public API
impl<T, A: Allocator> Vec<T, A> {
pub fn split_at_spare_mut(&mut self) -> (&mut [T], &mut [MaybeUninit<T>]) {}
}
Steps / History
- Implementation: Make Vec::split_at_spare_mut public #81687
- Final commenting period (FCP)
- Stabilization PR
Unresolved Questions
- Should we consider changing the name?
split_at_spare_mut
doesn't seem like an intuitive name - Should we deprecate
Vec::spare_capacity_mut
? Any usecase ofVec::spare_capacity_mut
can be replaced withVec::split_at_spare_mut
(but not vise-versa):
edit:spare_capacity_mut
has been stabilised now in Stabilize vec_spare_capacity #93016 so deprecating it is probably not an option