itertools icon indicating copy to clipboard operation
itertools copied to clipboard

`.try_collect()` for `Iterator<Option>`

Open amab8901 opened this issue 9 months ago • 7 comments

.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).

amab8901 avatar May 28 '24 07:05 amab8901