]> git.lizzy.rs Git - rust.git/commit
Rollup merge of #62278 - cuviper:iter-partition, r=alexcrichton
authorMazdak Farrokhzad <twingoow@gmail.com>
Wed, 10 Jul 2019 03:14:06 +0000 (05:14 +0200)
committerGitHub <noreply@github.com>
Wed, 10 Jul 2019 03:14:06 +0000 (05:14 +0200)
commitb14b20c6388da5379df078dc2e7ea3bff582af7d
tree688ea0b2bba425df55f71ac625635bffd7598e68
parent3c3e3756b0e9852960acda062f3c3da1ff079811
parent7171c83ab234926d620c4869eeac90b393833ef2
Rollup merge of #62278 - cuviper:iter-partition, r=alexcrichton

Add Iterator::partition_in_place() and is_partitioned()

`partition_in_place()` swaps `&mut T` items in-place to satisfy the
predicate, so all `true` items precede all `false` items. This requires
a `DoubleEndedIterator` so we can search from front and back for items
that need swapping.

`is_partitioned()` checks whether the predicate is already satisfied.