From daa6da766aabd27edc0011cacdb15a88971c9da8 Mon Sep 17 00:00:00 2001 From: "Felix S. Klock II" Date: Fri, 28 Feb 2014 14:07:42 +0100 Subject: [PATCH] Improve vec `partition` and `partitioned` method doc. Explicitly note in vec `partition` and `partitioned` that the left and right parts each map to satisfying and non-satisfying elements. --- src/libstd/vec.rs | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/libstd/vec.rs b/src/libstd/vec.rs index ce719c6d0b8..fba3538db83 100644 --- a/src/libstd/vec.rs +++ b/src/libstd/vec.rs @@ -1223,10 +1223,8 @@ impl<'a, T: TotalOrd> ImmutableTotalOrdVector for &'a [T] { /// Extension methods for vectors containing `Clone` elements. pub trait ImmutableCloneableVector { - /** - * Partitions the vector into those that satisfies the predicate, and - * those that do not. - */ + /// Partitions the vector into two vectors `(A,B)`, where all + /// elements of `A` satisfy `f` and all elements of `B` do not. fn partitioned(&self, f: |&T| -> bool) -> (~[T], ~[T]); /// Create an iterator that yields every possible permutation of the @@ -1394,9 +1392,10 @@ pub trait OwnedVector { * Like `filter()`, but in place. Preserves order of `v`. Linear time. */ fn retain(&mut self, f: |t: &T| -> bool); + /** - * Partitions the vector into those that satisfies the predicate, and - * those that do not. + * Partitions the vector into two vectors `(A,B)`, where all + * elements of `A` satisfy `f` and all elements of `B` do not. */ fn partition(self, f: |&T| -> bool) -> (~[T], ~[T]);