I’m just wondering what the prefered accepted idiomatic style is for map/fold use in this situation. I have a collection of channels each of which delivers one value – using channels to deliver partial sums of a computation. Originally I had:
channels.iter().fold(0.0, |acc, i| acc + i.1.recv().unwrap())
which works fine and is not unreadable. But then there is:
channels.iter().map(|i| i.1.recv().unwrap()).fold(0.0, Add::add)
which works equally well, and is equally not unreadable. Is one more idiomatic Rust style than the other – assuming that there are no performance implications.