[][src]Struct tinysort::TinySort

pub struct TinySort { /* fields omitted */ }

A truly memory-efficient sort implementation.

See the module documentation for more details. To retrieve the values sorted in this sorter, use the IntoIter implementation. It will yield the sorted values from smallest to largest.

Methods

impl TinySort[src]

pub fn new(extra: usize, amount: u32, maxval: u32) -> Option<TinySort>[src]

Create a new TinySort.

extra is the allowed memory overhead in units of 4 bytes. It should at least be 1 for the algorithm to function properly. amount is the amount of values to be sorted. This needs to at least be 2. maxval is the maximum value that will be sorted. This needs to be at least 1.

pub fn used_space(&self) -> usize[src]

The amount of memory, in bytes, used by the algorithm. This is roughly equal to (amount*log2(1+amount/maxval) + maxval*log2(1+maxval/amount)) / 8 + extra * 4.

pub fn insert(&mut self, value: u32)[src]

Insert a value to be sorted.

This might panic if there were more values inserted than amount, or if this value is higher than the maximum value specified.

Trait Implementations

impl Clone for TinySort[src]

impl Debug for TinySort[src]

impl IntoIterator for TinySort[src]

type Item = u32

The type of the elements being iterated over.

type IntoIter = TinySortIterator

Which kind of iterator are we turning this into?

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<I> IntoIterator for I where
    I: Iterator
[src]

type Item = <I as Iterator>::Item

The type of the elements being iterated over.

type IntoIter = I

Which kind of iterator are we turning this into?

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.