Trait timely_sort::RadixSorter [] [src]

pub trait RadixSorter<T, U: Unsigned>: RadixSorterBase<T> {
    fn push<F: Fn(&T) -> U>(&mut self, element: T, key: &F);
    fn push_batch<F: Fn(&T) -> U>(&mut self, batch: Vec<T>, key: &F);
    fn finish_into<F: Fn(&T) -> U>(&mut self, target: &mut Vec<Vec<T>>, key: &F);

    fn extend<F: Fn(&T) -> U, I: Iterator<Item = T>>(
        &mut self,
        iterator: I,
        key: &F
    ) { ... } fn finish<F: Fn(&T) -> U>(&mut self, key: &F) -> Vec<Vec<T>> { ... } fn sort<F: Fn(&T) -> U>(&mut self, batches: &mut Vec<Vec<T>>, key: &F) { ... } }

Functionality provided by a radix sorter.

These radix sorters allow you to specify a radix key function with each method call, so that the sorter does not need to reflect this (hard to name) type in its own type. This means you need to take some care and not abuse this.

Internally the sorters manage data using blocks Vec<T>, and are delighted to consume data in block form (they will re-use the blocks), and will return results as a sequence of blocks such that if they are traversed in-order they are appropriately sorted.

Most of the sorters manage a stash of buffers (ideally: 256) that they use when sorting the data. If this stash goes dry the sorters will allocate, but they much prefer to re-use buffers whenever possible, and if having consulted your sorted results you would like to return the buffers (using either recycle or rebalance) you should! The rebalance method allows you to control just how many buffers the sorter is sitting on.

Required Methods

Pushes a single element using the supplied radix key function.

Pushes a batch of elements using the supplied radix key function.

Completes the sorting session and puts the sorted results into target.

Provided Methods

Pushes a sequence of elements using the supplied radix key function.

Completes the sorting session and returns the sorted results.

Sorts batched data using the supplied radix key function.

Implementors