Skip to content

Commit 9373c66

Browse files
committed
---
yaml --- r: 32148 b: refs/heads/dist-snap c: 6277046 h: refs/heads/master v: v3
1 parent e958bb5 commit 9373c66

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@ refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: d0c6ce338884ee21843f4b40bf6bf18d222ce5df
99
refs/heads/incoming: d9317a174e434d4c99fc1a37fd7dc0d2f5328d37
10-
refs/heads/dist-snap: 4cfb92f4598a6571523bce8b72188df559e2a2b3
10+
refs/heads/dist-snap: 6277046fa0a5c119885ba33bcb6ac2f4fba0228f
1111
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1212
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/dist-snap/src/libcore/either.rs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,22 @@ pure fn is_right<T, U>(eith: &Either<T, U>) -> bool {
109109
match *eith { Right(_) => true, _ => false }
110110
}
111111

112+
pure fn unwrap_left<T,U>(+eith: Either<T,U>) -> T {
113+
//! Retrieves the value in the left branch. Fails if the either is Right.
114+
115+
match move eith {
116+
Left(move x) => x, Right(_) => fail ~"either::unwrap_left Right"
117+
}
118+
}
119+
120+
pure fn unwrap_right<T,U>(+eith: Either<T,U>) -> U {
121+
//! Retrieves the value in the right branch. Fails if the either is Left.
122+
123+
match move eith {
124+
Right(move x) => x, Left(_) => fail ~"either::unwrap_right Left"
125+
}
126+
}
127+
112128
#[test]
113129
fn test_either_left() {
114130
let val = Left(10);

0 commit comments

Comments
 (0)