1
Fork 0

add Vec::extend_from_within method

Implement <https://github.com/rust-lang/rfcs/pull/2714>, changes from the RFC:
- Rename the method `append_from_within` => `extend_from_within`
- Loose :Copy bound => :Clone
- Specialize in case of :Copy

This commit also adds `Vec::split_at_spare` private method and use it to implement
`Vec::spare_capacity_mut` and `Vec::extend_from_within`. This method returns 2
slices - initialized elements (same as `&mut vec[..]`) and uninitialized but
allocated space (same as `vec.spare_capacity_mut()`).
This commit is contained in:
Waffle 2020-11-13 12:50:12 +03:00
parent 95cbcad920
commit d5c221107e
4 changed files with 181 additions and 4 deletions

View file

@ -20,6 +20,7 @@
#![feature(int_bits_const)]
#![feature(vecdeque_binary_search)]
#![feature(slice_group_by)]
#![feature(vec_extend_from_within)]
use std::collections::hash_map::DefaultHasher;
use std::hash::{Hash, Hasher};