itertools
itertools copied to clipboard
`.try_collect()` for `Iterator<Option>`
.try_collect()
is for turning Iterator<Result<T>>
into Result<Iterator<T>>
. Can you create an equivalent method that turns Iterator<Option<T>>
into Option<Iterator<T>>
? Or perhaps implement it as a generic, as part of try_collect()
?
The use case is for creating programs that never crash at runtime (where error conditions are passed to the logs, and Result converted to Option, and program is continuing without interruption).