Is there a way to sort a slice in specifically 'ascending' or 'descending' order?
⚓ Rust 📅 2025-04-30 👤 surdeus 👁️ 9I need to sort a slice of elements where it is important that the element which compares as 'Greater' than the other elements in the slice ends up at index '0'.
Of course the regular slice::sort family of methods kind of do this in practice but I cannot find anything in any documentation specifying what direction they 'should' order the elements in. I need a function which guarantees either 'ascending' or 'descending' ordering even if the underlying implementation is changed.
12 posts - 5 participants
🏷️ rust_feed