Skip to content

Commit 10c0013

Browse files
committed
Add conversion from Either<A, B> to EitherOrBoth<A, B>
1 parent 62a6401 commit 10c0013

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/either_or_both.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -493,3 +493,12 @@ impl<A, B> Into<Option<Either<A, B>>> for EitherOrBoth<A, B> {
493493
}
494494
}
495495
}
496+
497+
impl<A, B> From<Either<A, B>> for EitherOrBoth<A, B> {
498+
fn from(either: Either<A, B>) -> Self {
499+
match either {
500+
Either::Left(l) => EitherOrBoth::Left(l),
501+
Either::Right(l) => EitherOrBoth::Right(l),
502+
}
503+
}
504+
}

0 commit comments

Comments
 (0)