aboutsummaryrefslogtreecommitdiff
path: root/src/lib/_vec.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/_vec.rs')
-rw-r--r--src/lib/_vec.rs15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/lib/_vec.rs b/src/lib/_vec.rs
index ab222be9..3718ac35 100644
--- a/src/lib/_vec.rs
+++ b/src/lib/_vec.rs
@@ -282,6 +282,21 @@ fn plus_option[T](&vec[T] v, &option.t[T] o) -> () {
}
}
+fn cat_options[T](&vec[option.t[T]] v) -> vec[T] {
+ let vec[T] res = vec();
+
+ for (option.t[T] o in v) {
+ alt (o) {
+ case (none[T]) { }
+ case (some[T](?t)) {
+ res += vec(t);
+ }
+ }
+ }
+
+ ret res;
+}
+
// TODO: Remove in favor of built-in "freeze" operation when it's implemented.
fn freeze[T](vec[mutable T] v) -> vec[T] {
let vec[T] result = vec();