diff --git a/src/lib/option.rs b/src/lib/option.rs index 25f82b52a0e73da25afd0db6e0fc19b687c5e9b5..29a6f6eb96ba644d24439ad2b347555324c6a6ef 100644 --- a/src/lib/option.rs +++ b/src/lib/option.rs @@ -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;