diff options
| author | Natrix <osken_o.s@hotmail.com> | 2025-04-30 20:25:47 +0200 |
|---|---|---|
| committer | Natrix <osken_o.s@hotmail.com> | 2025-04-30 20:25:47 +0200 |
| commit | b735dce5a67937b369fe8667c0e1c7d766588e05 (patch) | |
| tree | 4211ea8fa16983e06cd28175501390d9aa60b839 /library/alloc | |
| parent | 7188f453111502962326022740e2657fce0a6939 (diff) | |
docs: Specify that common sort functions sort in an ascending direction
Diffstat (limited to 'library/alloc')
| -rw-r--r-- | library/alloc/src/slice.rs | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/library/alloc/src/slice.rs b/library/alloc/src/slice.rs index 7c5d22e1ee9..b49b3f41a76 100644 --- a/library/alloc/src/slice.rs +++ b/library/alloc/src/slice.rs @@ -69,7 +69,7 @@ use crate::boxed::Box; use crate::vec::Vec; impl<T> [T] { - /// Sorts the slice, preserving initial order of equal elements. + /// Sorts the slice in ascending order, preserving initial order of equal elements. /// /// This sort is stable (i.e., does not reorder equal elements) and *O*(*n* \* log(*n*)) /// worst-case. @@ -137,7 +137,8 @@ impl<T> [T] { stable_sort(self, T::lt); } - /// Sorts the slice with a comparison function, preserving initial order of equal elements. + /// Sorts the slice in ascending order with a comparison function, preserving initial order of + /// equal elements. /// /// This sort is stable (i.e., does not reorder equal elements) and *O*(*n* \* log(*n*)) /// worst-case. @@ -197,7 +198,8 @@ impl<T> [T] { stable_sort(self, |a, b| compare(a, b) == Less); } - /// Sorts the slice with a key extraction function, preserving initial order of equal elements. + /// Sorts the slice in ascending order with a key extraction function, preserving initial order + /// of equal elements. /// /// This sort is stable (i.e., does not reorder equal elements) and *O*(*m* \* *n* \* log(*n*)) /// worst-case, where the key function is *O*(*m*). @@ -252,7 +254,8 @@ impl<T> [T] { stable_sort(self, |a, b| f(a).lt(&f(b))); } - /// Sorts the slice with a key extraction function, preserving initial order of equal elements. + /// Sorts the slice in ascending order with a key extraction function, preserving initial order + /// of equal elements. /// /// This sort is stable (i.e., does not reorder equal elements) and *O*(*m* \* *n* + *n* \* /// log(*n*)) worst-case, where the key function is *O*(*m*). |
