pub fn iterate_with_return<G, F>(
generator: G,
handle_return: F,
) -> impl Iterator<Item = G::Yield>Expand description
Turns the given generator into an iterator, with a function to handle the
GeneratorState::Complete(_) case.
The returned iterator iterates over Generator::Yield. When GeneratorState::Complete(_)
is returned, it calls handle_return with the returned value. The return of that call is then
emitted from the iterator. All subsequent calls to Iterator::next then return None.