pub trait Sleepsort: IntoIterator + Sized{
// Provided methods
fn sleepsort(self) -> SleepsortIter<Self::Item> ⓘ { ... }
fn sleepsort_with_speed(
self,
speed: SleepsortSpeed,
) -> SleepsortIter<Self::Item> ⓘ { ... }
}
Expand description
This trait provides the sleepsort
functionality
Provided Methods§
Sourcefn sleepsort(self) -> SleepsortIter<Self::Item> ⓘ
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.
Sourcefn sleepsort_with_speed(
self,
speed: SleepsortSpeed,
) -> SleepsortIter<Self::Item> ⓘ
fn sleepsort_with_speed( self, speed: SleepsortSpeed, ) -> SleepsortIter<Self::Item> ⓘ
sleepsort
with a custom speed. See
SleepsortSpeed
for more information.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.