`<[T]>::sort_by_index` and `<[T]>::sort_by_key_and_index`
Rust Internals [Unofficial]
April 16, 2026
Hmm, since we have the "apply a permutation" code, maybe it would be reasonable to start with an unsafe method exposing that? They you could always make your own permutation however you need to without also needing to apply it yourself.
I don't know a great (non-allocating) way to check that something is a permutation, though, for a safe API...
Discussion in the ATmosphere