auto merge of #12622 : pnkfelix/rust/fsk-improve-vec-partition-doc, r=huonw

Explicitly note in vec `partition` and `partitioned` that the left and
right parts each map to satisfying and non-satisfying elements.
This commit is contained in:
bors 2014-02-28 07:26:30 -08:00
commit 9b1be3d182
1 changed files with 5 additions and 6 deletions

View File

@ -1223,10 +1223,8 @@ impl<'a, T: TotalOrd> ImmutableTotalOrdVector<T> for &'a [T] {
/// Extension methods for vectors containing `Clone` elements. /// Extension methods for vectors containing `Clone` elements.
pub trait ImmutableCloneableVector<T> { pub trait ImmutableCloneableVector<T> {
/** /// Partitions the vector into two vectors `(A,B)`, where all
* Partitions the vector into those that satisfies the predicate, and /// elements of `A` satisfy `f` and all elements of `B` do not.
* those that do not.
*/
fn partitioned(&self, f: |&T| -> bool) -> (~[T], ~[T]); fn partitioned(&self, f: |&T| -> bool) -> (~[T], ~[T]);
/// Create an iterator that yields every possible permutation of the /// Create an iterator that yields every possible permutation of the
@ -1394,9 +1392,10 @@ pub trait OwnedVector<T> {
* Like `filter()`, but in place. Preserves order of `v`. Linear time. * Like `filter()`, but in place. Preserves order of `v`. Linear time.
*/ */
fn retain(&mut self, f: |t: &T| -> bool); fn retain(&mut self, f: |t: &T| -> bool);
/** /**
* Partitions the vector into those that satisfies the predicate, and * Partitions the vector into two vectors `(A,B)`, where all
* those that do not. * elements of `A` satisfy `f` and all elements of `B` do not.
*/ */
fn partition(self, f: |&T| -> bool) -> (~[T], ~[T]); fn partition(self, f: |&T| -> bool) -> (~[T], ~[T]);