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.


you could use map maybe

1 Like


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.

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.