aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir/src/either.rs
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2019-06-10 23:06:11 +0100
committerAleksey Kladov <[email protected]>2019-06-10 23:26:20 +0100
commit156b7ee84210583fa2fdc7fb8ae1dccafdf80830 (patch)
tree5e0d18e023a095c64a02f1c44c4a82245c89beeb /crates/ra_hir/src/either.rs
parent75e6c03883c4533b1134c806d166b72200b4837d (diff)
use single version of either in hir
Diffstat (limited to 'crates/ra_hir/src/either.rs')
-rw-r--r--crates/ra_hir/src/either.rs18
1 files changed, 18 insertions, 0 deletions
diff --git a/crates/ra_hir/src/either.rs b/crates/ra_hir/src/either.rs
index 4073cc82e..71c53ebc0 100644
--- a/crates/ra_hir/src/either.rs
+++ b/crates/ra_hir/src/either.rs
@@ -25,4 +25,22 @@ impl<A, B> Either<A, B> {
25 Either::B(b) => Either::B(f2(b)), 25 Either::B(b) => Either::B(f2(b)),
26 } 26 }
27 } 27 }
28 pub fn a(self) -> Option<A> {
29 match self {
30 Either::A(it) => Some(it),
31 Either::B(_) => None,
32 }
33 }
34 pub fn b(self) -> Option<B> {
35 match self {
36 Either::A(_) => None,
37 Either::B(it) => Some(it),
38 }
39 }
40 pub fn as_ref(&self) -> Either<&A, &B> {
41 match self {
42 Either::A(it) => Either::A(it),
43 Either::B(it) => Either::B(it),
44 }
45 }
28} 46}