about summary refs log tree commit diff
path: root/library/std/src/sys/unix/stack_overflow.rs
diff options
context:
space:
mode:
authorYuki Okushi <huyuumi.dev@gmail.com>2021-02-10 12:24:22 +0900
committerGitHub <noreply@github.com>2021-02-10 12:24:22 +0900
commite2765f8cbdfce02816aff7bce4c4d41bfea2c5d4 (patch)
tree7b2316579f8ac1d42dfc83b36fc71542217a1cbe /library/std/src/sys/unix/stack_overflow.rs
parent3f09418cbe0cc598e8b0567626c2c800a09cc9cc (diff)
parent8ff7b75c016af8bebf995f12e7e5b246ad849470 (diff)
downloadrust-e2765f8cbdfce02816aff7bce4c4d41bfea2c5d4.tar.gz
rust-e2765f8cbdfce02816aff7bce4c4d41bfea2c5d4.zip
Rollup merge of #81687 - WaffleLapkin:split_at_spare, r=KodrAus
Make Vec::split_at_spare_mut public

This PR introduces a new method to the public API, under
`vec_split_at_spare` feature gate:

```rust
impl<T, A: Allocator> impl Vec<T, A> {
    pub fn split_at_spare_mut(&mut self) -> (&mut [T], &mut [MaybeUninit<T>]);
}
```

The method returns 2 slices, one slice references the content of the vector,
and the other references the remaining spare capacity.

The method was previously implemented while adding `Vec::extend_from_within` in #79015,
and used to implement `Vec::spare_capacity_mut` (as the later is just a
subset of former one).

See also previous [discussion in `Vec::spare_capacity_mut` tracking issue](https://github.com/rust-lang/rust/issues/75017#issuecomment-770381335).

## 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 of `Vec::spare_capacity_mut` can be replaced with `Vec::split_at_spare_mut` (but not vise-versa)

r? `@KodrAus`
Diffstat (limited to 'library/std/src/sys/unix/stack_overflow.rs')
0 files changed, 0 insertions, 0 deletions