In #340 scan::execute has several layers of nested iterators. This leads to many calls to flatten_ok to manage the deep nesting. All the flatten_ok's make the code unclear and harder to reason about.
Create an Iterator type which manages and hides the complexity of the nested iterators. This iterator must be able to manage types like Result<Iterator<Item=...>> and Iterator<Item=<Result<...>>>.