Skip to content

Commit

Permalink
Merge pull request #21 from cuviper/flatten-either
Browse files Browse the repository at this point in the history
Flatten the implementation of Either::either
  • Loading branch information
bluss committed Mar 3, 2018
2 parents f49c3a5 + 0ba2f93 commit 22a5175
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,10 @@ impl<L, R> Either<L, R> {
where F: FnOnce(L) -> T,
G: FnOnce(R) -> T
{
self.either_with((), move |(), x| f(x), move |(), x| g(x))
match self {
Left(l) => f(l),
Right(r) => g(r),
}
}

/// Like `either`, but provide some context to whichever of the
Expand Down

0 comments on commit 22a5175

Please sign in to comment.