Skip to content

Commit d720a19

Browse files
committed
Update doc comment
1 parent 83d5998 commit d720a19

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

src/libcore/slice/mod.rs

+10-6
Original file line numberDiff line numberDiff line change
@@ -2664,13 +2664,17 @@ impl<T> [T] {
26642664
self.iter().is_sorted_by_key(f)
26652665
}
26662666

2667-
/// Returns index of partition point according to the given predicate,
2668-
/// such that all those that return true precede the index and
2669-
/// such that all those that return false succeed the index.
2667+
/// Returns the index of the partition point according to the given predicate
2668+
// (the index of the first element of the second partition).
26702669
///
2671-
/// The slice must be partitioned
2672-
/// so that all elements where the predicate returns true
2673-
/// precede the elements where the predicate returns false.
2670+
/// The slice is assumed to be partitioned according to the given predicate.
2671+
/// This means that all elements for which the predicate returns true are at the start of the slice
2672+
/// and all elements for which the predicate returns false are at the end.
2673+
/// For example, [7, 15, 3, 5, 4, 12, 6] is a partitioned under the predicate x % 2 != 0
2674+
/// (all odd numbers are at the start, all even at the end).
2675+
///
2676+
/// If this slice is not partitioned, the returned result is unspecified and meaningless,
2677+
/// as this method performs a kind of binary search.
26742678
///
26752679
/// # Examples
26762680
///

0 commit comments

Comments
 (0)