radsort

Function sort

Source
pub fn sort<T: Key>(slice: &mut [T])
Expand description

Sorts the slice.

Slice elements can be any scalar type. See Key for a full list.

This sort is stable (i.e., does not reorder equal elements) and O(w n), where w is the size of the key in bytes.

Allocates temporary storage the size of the slice.

ยงExamples

let mut data = [5i32, -1, 3, 15, -42];

radsort::sort(&mut data);

assert_eq!(data, [-42, -1, 3, 5, 15]);