Feature gate: `#![feature(vec_push_within_capacity)]` This is a tracking issue for `Vec::push_within_capacity` It enables pushing into a Vec if there is any capacity left and otherwise returns the value. I.e. it avoids implicit resizing. This can be useful when one wants to explicitly control it (e.g. via `try_reserve`) or uses a Vec in an unsafe manner where moving the elements would be a problem. ### Public API ```rust / alloc::Vec impl Vec<T, A> { pub fn push_within_capacity(&mut self, value: T) -> Result<&mut T, T>; } ``` ### Steps / History <!-- For larger features, more steps might be involved. If the feature is changed later, please add those PRs here as well. --> - [x] Implementation: #89123, https://github.com/rust-lang/rfcs/pull/3271 [^1]: https://std-dev-guide.rust-lang.org/feature-lifecycle/stabilization.html