@schlink You may need to use .fold() instead of .map()
https://doc.rust-lang.org/std/iter/trait.Iterator.html#method.fold
rust
@schlink i'd have used that:
let slices_needed: usize = persons.iter().map(|p| p.slices_requested).sum();
with map to get the number we need, and sum to concisely sum them.
fold could work too but i find it more verbose and less elegant
rust
@schlink heeeeey, so you're back, learning things about Rust! Ping me anytime, and how's async going?
rust
with some help from @CobaltVelvet @george_ and @jeancf, I learned a bit about #Rust's fold and map methods this morning
https://sts10.github.io/2020/09/08/rust-map-fold.html