I'd like to change the below code to avoid using .unwrap or .expect :
thread::scope(|s| {
for name in names {
s.spawn(move |_| {
let path_to_file = format!("{}{}", base, name.as_str());
let path_to_file_written = format!("{}{}", guichetout, name.as_str());
write_file(path_to_file.as_str(), name.as_str(), guichetout)
.expect("cannot write data");
log_hash(&path_to_file_written)
.expect("Cannot write hash !");
});
}
})
.unwrap();
I'm currently using crossbeam_utils::thread and I'm thinking about switching to rayon. So I need to change this code into an iterator with various combinators. I've tried a lot of things but nothing works properly. So if anyone can help me, that would be great.