Sorts a sequence of items by comparing their byte-slice representations. The caller must supply an output buffer `order` whose length is at least equal to the length of `data`. On success, the function writes the sorted permutation indices into `order`. # Example ```rust use stringzilla::stringzilla as sz; let fruits = ["banana", "apple", "cherry"]; let mut order = [0; 3]; sz::argsort_permutat
(data: &[T], order: &mut [SortedIdx])
| 2184 | /// assert_eq!(&order, &[1, 0, 2]); // "apple", "banana", "cherry" |
| 2185 | /// ``` |
| 2186 | pub fn argsort_permutation<T: AsRef<[u8]>>(data: &[T], order: &mut [SortedIdx]) -> Result<(), Status> { |
| 2187 | if data.len() > order.len() { |
| 2188 | return Err(Status::BadAlloc); |
| 2189 | } |
| 2190 | argsort_permutation_by(|i| data[i].as_ref(), order[..data.len()].as_mut()) |
| 2191 | } |
| 2192 | |
| 2193 | /// Sorts a sequence of items by comparing their corresponding byte-slice representations. |
| 2194 | /// The size of the permutation is inferred from the length of the `order` slice. |
searching dependent graphs…