Add an option.is_none() method

This commit is contained in:
Patrick Walton 2011-03-17 11:21:11 -07:00
parent ea7197e2cf
commit 84321d1f59

View file

@ -31,6 +31,13 @@ fn map[T, U](&operator[T, U] f, &t[T] opt) -> t[U] {
fail; // FIXME: remove me when exhaustiveness checking works
}
fn is_none[T](&t[T] opt) -> bool {
alt (opt) {
case (none[T]) { ret true; }
case (some[T](_)) { ret false; }
}
}
// Local Variables:
// mode: rust;
// fill-column: 78;