Calls the transform function on the current value. Can return in several ways If the next value is requested (e.g. skip) it will return an empty optional If an invalid status is encountered that will be returned If finished it will return IterationTraits ::End() If a value is returned by the transformer that will be returned
| 293 | // * If finished it will return IterationTraits<V>::End() |
| 294 | // * If a value is returned by the transformer that will be returned |
| 295 | Result<std::optional<V>> Pump() { |
| 296 | if (!finished_ && last_value_.has_value()) { |
| 297 | auto next_res = transformer_(*last_value_); |
| 298 | if (!next_res.ok()) { |
| 299 | finished_ = true; |
| 300 | return next_res.status(); |
| 301 | } |
| 302 | auto next = std::move(*next_res); |
| 303 | if (next.ReadyForNext()) { |
| 304 | if (IsIterationEnd(*last_value_)) { |
| 305 | finished_ = true; |
| 306 | } |
| 307 | last_value_.reset(); |
| 308 | } |
| 309 | if (next.Finished()) { |
| 310 | finished_ = true; |
| 311 | } |
| 312 | if (next.HasValue()) { |
| 313 | return next.Value(); |
| 314 | } |
| 315 | } |
| 316 | if (finished_) { |
| 317 | return IterationTraits<V>::End(); |
| 318 | } |
| 319 | return std::nullopt; |
| 320 | } |
| 321 | |
| 322 | Iterator<T> it_; |
| 323 | Transformer<T, V> transformer_; |
nothing calls this directly
no test coverage detected