[−][src]Trait sorting::Sleepsort
This trait provides the sleepsort
functionality
Provided methods
ⓘImportant traits for SleepsortIter<I>fn sleepsort(self) -> SleepsortIter<Self::Item>
ⓘImportant traits for SleepsortIter<I>
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>
ⓘImportant traits for SleepsortIter<I>
self,
speed: SleepsortSpeed
) -> SleepsortIter<Self::Item>
sleepsort
with a custom speed. See
SleepsortSpeed
for more information.
Implementors
impl<T> Sleepsort for T where
T: IntoIterator + Sized,
T::Item: SleepsortItem + PartialOrd + Send + 'static,
[src]
T: IntoIterator + Sized,
T::Item: SleepsortItem + PartialOrd + Send + 'static,