Skip to content

Commit

Permalink
Add conversion from Either<A, B> to EitherOrBoth<A, B>
Browse files Browse the repository at this point in the history
  • Loading branch information
glandium committed Jul 25, 2023
1 parent 62a6401 commit 10c0013
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 10c0013

Please sign in to comment.