rdst
rdst is a flexible native Rust implementation of unstable radix sort.
Usage
In the simplest case, you can use this sort by simply calling my_vec.radix_sort_unstable(). If you have a custom type to sort, you may need to implement RadixKey for that type.
Default Implementations
RadixKey is implemented for Vec of the following types out-of-the-box:
u8u16u32u64u128[u8; N]
Implementing RadixKey
To be able to sort custom types, implement RadixKey as below.
LEVELSshould be set to the total number of bytes you will consider for each item being sortedget_levelshould return the corresponding bytes in the order you would like them to be sorted. This library is intended to be used starting from the MSB (most significant bits).
Note that this also allows you to implement radix keys that span multiple values.
License
Licensed under either of
- Apache License, Version 2.0, (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.
Contribution
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.