| 82 | |
| 83 | template <typename T> |
| 84 | IteratorResults<T> IteratorToResults(Iterator<T> iterator) { |
| 85 | IteratorResults<T> results; |
| 86 | |
| 87 | while (true) { |
| 88 | auto res = iterator.Next(); |
| 89 | if (res == IterationTraits<T>::End()) { |
| 90 | break; |
| 91 | } |
| 92 | if (res.ok()) { |
| 93 | results.values.push_back(*std::move(res)); |
| 94 | } else { |
| 95 | results.errors.push_back(res.status()); |
| 96 | } |
| 97 | } |
| 98 | return results; |
| 99 | } |
| 100 | |
| 101 | // So that main thread may wait a bit for a future to be finished |
| 102 | constexpr auto kYieldDuration = std::chrono::microseconds(50); |