diff options
| author | Felix S. Klock II <pnkfelix@pnkfx.org> | 2014-02-28 14:07:42 +0100 |
|---|---|---|
| committer | Felix S. Klock II <pnkfelix@pnkfx.org> | 2014-02-28 14:15:29 +0100 |
| commit | daa6da766aabd27edc0011cacdb15a88971c9da8 (patch) | |
| tree | 4cdb2ac5045490bb8b9ac9a10a2647f68fc52695 /src/libstd/vec.rs | |
| parent | 31e9c947a3303b4b785f9a7f130b00c625456326 (diff) | |
| download | rust-daa6da766aabd27edc0011cacdb15a88971c9da8.tar.gz rust-daa6da766aabd27edc0011cacdb15a88971c9da8.zip | |
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.
Diffstat (limited to 'src/libstd/vec.rs')
| -rw-r--r-- | src/libstd/vec.rs | 11 |
1 files 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<T> for &'a [T] { /// Extension methods for vectors containing `Clone` elements. pub trait ImmutableCloneableVector<T> { - /** - * 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<T> { * 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]); |
