collections: Implement String::drain(range) according to RFC 574
`.drain(range)` is unstable and under feature(collections_drain). This adds a safe way to remove any range of a String as efficiently as possible. As noted in the code, this drain iterator has none of the memory safety issues of the vector version. RFC tracking issue is #23055
This commit is contained in:
parent
42bfeec53c
commit
ee48e6d192
3 changed files with 126 additions and 1 deletions
|
|
@ -21,6 +21,7 @@ use collections::{BitSet, BitVec};
|
|||
use collections::{BTreeMap, BTreeSet};
|
||||
use collections::EnumSet;
|
||||
use collections::LinkedList;
|
||||
use collections::String;
|
||||
use collections::Vec;
|
||||
use collections::VecDeque;
|
||||
use collections::VecMap;
|
||||
|
|
@ -99,4 +100,5 @@ fn main() {
|
|||
|
||||
all_sync_send!(Vec::<usize>::new(), into_iter);
|
||||
is_sync_send!(Vec::<usize>::new(), drain(..));
|
||||
is_sync_send!(String::new(), drain(..));
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue