mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-29 18:23:49 +00:00
21 lines
216 B
Rust
21 lines
216 B
Rust
|
fn foo[T](&myoption[T] o) -> int {
|
||
|
let int x;
|
||
|
|
||
|
alt (o) {
|
||
|
case (none[T]) { fail; }
|
||
|
case (some[T](?t)) {
|
||
|
x = 5;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
ret x;
|
||
|
}
|
||
|
|
||
|
tag myoption[T] {
|
||
|
none;
|
||
|
some(T);
|
||
|
}
|
||
|
|
||
|
fn main() {
|
||
|
log(5);
|
||
|
}
|