Skip to content

Commit 0efd7fa

Browse files
committed
stdlib: Add option::is_some
1 parent 49a4867 commit 0efd7fa

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/lib/option.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ fn is_none[T](&t[T] opt) -> bool {
2121
ret alt (opt) { case (none) { true } case (some(_)) { false } };
2222
}
2323

24+
fn is_some[T](&t[T] opt) -> bool {
25+
ret !is_none(opt);
26+
}
27+
2428
fn from_maybe[T](&T def, &t[T] opt) -> T {
2529
auto f = bind util::id[T](_);
2630
ret maybe[T, T](def, f, opt);

0 commit comments

Comments
 (0)