Update functions in Result and Either to be iterator-based#8526
Closed
bluss wants to merge 3 commits intorust-lang:masterfrom
bluss:either-result
Closed
Update functions in Result and Either to be iterator-based#8526bluss wants to merge 3 commits intorust-lang:masterfrom bluss:either-result
bluss wants to merge 3 commits intorust-lang:masterfrom
bluss:either-result
Conversation
added 3 commits
August 15, 2013 02:52
Remove the only use of either::partition since it was better accomplished with vector methods. Update either::partition so that it sizes the vectors correctly before it starts.
Replace these with three functions based on iterators: collect, fold, and fold_. The mapping part is replaced by iterator .map(), so the part that these functions do is to accumulate the final Result<,> value. * `result::collect` gathers `Iterator<Result<V, U>>` to `Result<~[V], U>` * `result::fold` folds `Iterator<Result<T, E>>` to `Result<V, E>` * `result::fold_` folds `Iterator<Result<T, E>>` to `Result<(), E>`
bors
added a commit
that referenced
this pull request
Aug 16, 2013
Retry of PR #8471 Replace the remaining functions marked for issue #8228 with similar functions that are iterator-based. Change `either::{lefts, rights}` to be iterator-filtering instead of returning a vector. Replace `map_vec`, `map_vec2`, `iter_vec2` in std::result with three functions: * `result::collect` gathers `Iterator<Result<V, U>>` to `Result<~[V], U>` * `result::fold` folds `Iterator<Result<T, E>>` to `Result<V, E>` * `result::fold_` folds `Iterator<Result<T, E>>` to `Result<(), E>`
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.
Retry of PR #8471
Replace the remaining functions marked for issue #8228 with similar functions that are iterator-based.
Change
either::{lefts, rights}to be iterator-filtering instead of returning a vector.Replace
map_vec,map_vec2,iter_vec2in std::result with three functions:result::collectgathersIterator<Result<V, U>>toResult<~[V], U>result::foldfoldsIterator<Result<T, E>>toResult<V, E>result::fold_foldsIterator<Result<T, E>>toResult<(), E>