rust/src/test/run-pass/alt-ref-binding.rs
2012-08-26 15:56:16 -07:00

11 lines
158 B
Rust

fn destructure(x: Option<int>) -> int {
match x {
None => 0,
Some(ref v) => *v
}
}
fn main() {
assert destructure(Some(22)) == 22;
}