itertools
itertools copied to clipboard
try_fold_while
I found myself wanting a try_fold_while... Since there fold_while is not in std, I don't suppose it's the right time to RFC try_fold_while in std. So, would it be accepted here?
I haven't gotten into any detail, but I imagine it to be a straightforward combination of try_fold and fold_while.
The Try trait behind try_fold is unstable so we can't specialize them. And I think try_ methods should use Try. We only have one try_ method: try_collect which is in conflict with the unstable std one. An alternative would be fold_while_ok (we have a bunch of _ok methods, I don't know if we want more), or use our process_results (it_res.process_results(|it| it.fold_while(...))) but it doesn't specialize try_fold either so I guess the performance might be unsatisfying.
I suppose we wait, then.