[][src]Trait sorting::Sleepsort

pub trait Sleepsort: IntoIterator + Sized where
    Self::Item: SleepsortItem + PartialOrd + Send + 'static, 
{ fn sleepsort(self) -> SleepsortIter<Self::Item> { ... }
fn sleepsort_with_speed(
        self,
        speed: SleepsortSpeed
    ) -> SleepsortIter<Self::Item> { ... } }

This trait provides the sleepsort functionality

Provided methods

Important traits for SleepsortIter<I>
fn sleepsort(self) -> SleepsortIter<Self::Item>

Sleepsort is an unstable time-based variation of Countingsort that works by assigning every value to a thread and putting that thread to sleep for a time that is determined by that value:

for i in values:
    spawn a thread that sleeps i seconds
    output i

Unlike many other implementations, this one does not just print the values in order, but actually collects them, and is able to sort negative signed integers. Using it for other types is easily possible by simply implementing the SleepsortItem trait.

Important traits for SleepsortIter<I>
fn sleepsort_with_speed(
    self,
    speed: SleepsortSpeed
) -> SleepsortIter<Self::Item>

sleepsort with a custom speed. See SleepsortSpeed for more information.

Loading content...

Implementors

impl<T> Sleepsort for T where
    T: IntoIterator + Sized,
    T::Item: SleepsortItem + PartialOrd + Send + 'static, 
[src]

Loading content...