For_each which handles Result and "?"

Does either std or itertools have implementation of for_each which handles Result and "?"?
It would simplify complexity of my code significantly.

Yes, try_for_each.

But you could also just do a for loop.

2 Likes

you could use map maybe

1 Like

.collect::<()>()

1 Like

Yes, I used it, but it's cumbersome solution, which personally I would prefer to avoid.

Looks like what I have been looking for.
Works perfectly well! Thank you!

Really? But then I need to do folding or something, right?

Thank you, all :purple_heart:

For a bunch of different possibilities, depending what you want, see Iterating over Results - Rust By Example

1 Like

That is helpful. Thank you.