Skip to content

Commit

Permalink
Merge #715
Browse files Browse the repository at this point in the history
715: Add conversion from Either<A, B> to EitherOrBoth<A, B> r=phimuemue a=glandium



Co-authored-by: Mike Hommey <[email protected]>
  • Loading branch information
bors[bot] and glandium authored Jul 26, 2023
2 parents 62a6401 + 10c0013 commit 007ae45
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/either_or_both.rs
Original file line number Diff line number Diff line change
Expand Up @@ -493,3 +493,12 @@ impl<A, B> Into<Option<Either<A, B>>> for EitherOrBoth<A, B> {
}
}
}

impl<A, B> From<Either<A, B>> for EitherOrBoth<A, B> {
fn from(either: Either<A, B>) -> Self {
match either {
Either::Left(l) => EitherOrBoth::Left(l),
Either::Right(l) => EitherOrBoth::Right(l),
}
}
}

0 comments on commit 007ae45

Please sign in to comment.