about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorMazdak Farrokhzad <twingoow@gmail.com>2019-08-06 15:36:27 +0200
committerGitHub <noreply@github.com>2019-08-06 15:36:27 +0200
commitc32735d03c5dffe4acf79f500bb2f248469a4e66 (patch)
tree8a7c0a9c1062e6b324daa5bf4656add88c2375ff /src/test
parent8996328ebf34aa73e83a1db326767c11041f811d (diff)
parent2e41ba8742c341eaf1ec1b5954e089e4d2c02dd0 (diff)
downloadrust-c32735d03c5dffe4acf79f500bb2f248469a4e66.tar.gz
rust-c32735d03c5dffe4acf79f500bb2f248469a4e66.zip
Rollup merge of #62459 - timvermeulen:result_sum_internal_iteration, r=scottmcm
Use internal iteration in the Sum and Product impls of Result and Option

This PR adds internal iteration to the `ResultShunt` iterator type underlying the `Sum` and `Product` impls of `Result`. I had to change `ResultShunt` to hold a mutable reference to an error instead, similar to `itertools::ProcessResults`, in order to be able to pass the `ResultShunt` itself by value (which is necessary for internal iteration).

`ResultShunt::process` can unfortunately no longer be an associated function because that would make it generic over the lifetime of the error reference, which wouldn't work, so I turned it into the free function `process_results`.

I removed the `OptionShunt` type and forwarded the `Sum` and `Product` impls of `Option` to their respective impls of `Result` instead, to avoid having to repeat the internal iteration logic.
Diffstat (limited to 'src/test')
0 files changed, 0 insertions, 0 deletions