Rust - Handling Results In A Map Closure

10 points by BD103


Riolku

I usually lean towards collect(), but it's cool to see alternatives

lake

I often struggle with fallible functions in maps, and felt really empowered when I first learned that you can collect into a Result. But doing that does sometimes produce some unwieldy-looking code. Those turbofishes especially get gnarly.

I sometimes have to remind myself that a for loop is almost never the least clear option, especially if I'm calling a bunch of fallible operations, or get lost in the intermediate types.