I wanted to convert an Iterator of Result's into an Iterator of the inner values, but stopping at the first error and still having access to it, so threw together this code: https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=b3dcfad8212bd320dfee1f961a7f3aff .
My question is: Am I missing something built-in that does this already? If not, should/could the code be implemented in a better way?
PS: I'm aware of FromIterator, however I'd like to have an Iterator of inner values (not Result's) to work with while not having to collect them first. Perhaps I'm missing something obvious here.
Thanks.