[−][src]Struct tinysort::TinySort
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?
fn into_iter(self) -> TinySortIterator
[src]
Auto Trait Implementations
impl RefUnwindSafe for TinySort
impl Send for TinySort
impl Sync for TinySort
impl Unpin for TinySort
impl UnwindSafe for TinySort
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<I> IntoIterator for I where
I: Iterator,
[src]
I: Iterator,
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?
fn into_iter(self) -> I
[src]
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,