You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// Create a vector of ports, one for each child thread
let rxs = Vec::from_fn(3, |init_val| {
let (tx, rx) = channel();
spawn(move || {
tx.send(some_expensive_computation(init_val));
});
rx
});
// Wait on each port, accumulating the results
let result = rxs.iter().fold(0, |accum, rx| accum + rx.recv() );
Looking at the source code in libcollections there doesn't seem to be such a method alltogether.
The text was updated successfully, but these errors were encountered:
Info located at: http://doc.rust-lang.org/book/tasks.html
Looking at the source code in libcollections there doesn't seem to be such a method alltogether.
The text was updated successfully, but these errors were encountered: