Trait RadixSortKey

Source
pub trait RadixSortKey: Ord {
    const DELEGATION_SIZE: usize = 128usize;
    const HAS_CONST_KEY_LEN: bool = false;
    const MAX_KEY_LEN: Option<usize> = None;

    // Required methods
    fn key_len(&self) -> usize;
    fn key_byte(&self, byte: usize) -> u8;

    // Provided methods
    fn std_sort_size_threshold() -> usize { ... }
    fn depth_threshold() -> usize { ... }
}
Expand description

A key which can be used for radix sorts

Provided Associated Constants§

Source

const DELEGATION_SIZE: usize = 128usize

Get at what size to delegate this sort to another algorithm. This is a hint.

Source

const HAS_CONST_KEY_LEN: bool = false

Get whether the key length for this type is always constant

Source

const MAX_KEY_LEN: Option<usize> = None

Get the maximum key length for this type

Required Methods§

Source

fn key_len(&self) -> usize

Get the length of this key in bytes

Source

fn key_byte(&self, byte: usize) -> u8

Get the nth byte of this key. Well-defined for all n up to key_len

Provided Methods§

Source

fn std_sort_size_threshold() -> usize

Size threshold to use std sort

Source

fn depth_threshold() -> usize

Depth threshold to switch algorithm

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl RadixSortKey for &str

Source§

fn key_len(&self) -> usize

Source§

fn key_byte(&self, byte: usize) -> u8

Source§

impl<K> RadixSortKey for &[K]

Source§

fn key_len(&self) -> usize

Source§

fn key_byte(&self, byte: usize) -> u8

Source§

impl<K> RadixSortKey for Vec<K>
where K: ConstRadixSortKey, Vec<K>: Ord,

Source§

fn key_len(&self) -> usize

Source§

fn key_byte(&self, byte: usize) -> u8

Implementors§