Add flat_map_ok iterator adaptor#1087
Open
veeceey wants to merge 1 commit intorust-itertools:masterfrom
Open
Conversation
Implements flat_map_ok, which applies a function to Ok(T) values and flattens the resulting iterator, passing Err values through unchanged. Equivalent to .map_ok(f).flatten_ok() but avoids the intermediate iterator type. Supports DoubleEndedIterator, FusedIterator, Clone, Debug, fold/rfold optimizations. Closes rust-itertools#528
Author
|
Test results: Full test suite also passes (202 tests). |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1087 +/- ##
==========================================
- Coverage 94.38% 93.25% -1.14%
==========================================
Files 48 52 +4
Lines 6665 6571 -94
==========================================
- Hits 6291 6128 -163
- Misses 374 443 +69 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds a
flat_map_okadaptor that applies a function toOkvalues and flattens the result, passingErrvalues through unchanged. Basically a combined.map_ok(f).flatten_ok()in a single step.The implementation follows the same pattern as the existing
flatten_okadaptor, with support for:DoubleEndedIterator(when the inner iterator supports it)FusedIteratorClone/Debugfold/rfoldoptimizationsExample usage:
Closes #528