Skip to content

Commit 84321d1

Browse files
committed
Add an option.is_none() method
1 parent ea7197e commit 84321d1

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/lib/option.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,13 @@ fn map[T, U](&operator[T, U] f, &t[T] opt) -> t[U] {
3131
fail; // FIXME: remove me when exhaustiveness checking works
3232
}
3333

34+
fn is_none[T](&t[T] opt) -> bool {
35+
alt (opt) {
36+
case (none[T]) { ret true; }
37+
case (some[T](_)) { ret false; }
38+
}
39+
}
40+
3441
// Local Variables:
3542
// mode: rust;
3643
// fill-column: 78;

0 commit comments

Comments
 (0)