提交 84321d1f 编写于 作者: P Patrick Walton

Add an option.is_none() method

上级 ea7197e2
......@@ -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;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册