refactoring
Cargo Check, Format, Fix and Test / cargo CI (push) Successful in 1m22s
Details
Cargo Check, Format, Fix and Test / cargo CI (push) Successful in 1m22s
Details
This commit is contained in:
parent
86c0743c8b
commit
e56dfceaa8
|
@ -57,14 +57,7 @@ async fn main() {
|
|||
// stops earlier sometimes
|
||||
let (sender, recv) = std::sync::mpsc::channel();
|
||||
rayon::spawn(move || {
|
||||
for i in 0..separate + 1 {
|
||||
match sender.send((range.par_iter().map(|n| *n as u128).sum(), i)) {
|
||||
Ok(_) => (),
|
||||
Err(err) => {
|
||||
eprintln!("{err}");
|
||||
break;
|
||||
}
|
||||
}
|
||||
for i in 0..separate {
|
||||
range
|
||||
.par_iter_mut()
|
||||
.skip(i)
|
||||
|
@ -75,8 +68,14 @@ async fn main() {
|
|||
let _ = write!(std::io::Sink::default(), "{num}");
|
||||
}
|
||||
});
|
||||
match sender.send((range.par_iter().map(|n| *n as u128).sum(), i + 1)) {
|
||||
Ok(_) => (),
|
||||
Err(err) => {
|
||||
eprintln!("{err}");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
println!("DONE!");
|
||||
});
|
||||
loop {
|
||||
match recv.recv() {
|
||||
|
|
Loading…
Reference in New Issue