Sorting algorithms/Sleep sort: Difference between revisions

→‎{{header|Rust}}: slight simplification, eliminates an allocation
(→‎{{header|Rust}}: give the Rust version a main function and example output)
(→‎{{header|Rust}}: slight simplification, eliminates an allocation)
Line 1,169:
<lang rust>use std::thread;
 
fn sleepsort(nums<I: VecIterator<Item=u32>>(nums: I) {
let mut threads = Vec::new();
for n in nums {
Line 1,180:
 
fn main() {
sleepsort(std::env::args().skip(1).map(|s| FromStr::from_str(&s).unwrapparse()).collectunwrap()));
use std::str::FromStr;
use std::env::args;
sleepsort(args().skip(1).map(|s| FromStr::from_str(&s).unwrap()).collect());
}</lang>
Output:
Anonymous user