PageRenderTime 10ms CodeModel.GetById 1ms app.highlight 4ms RepoModel.GetById 1ms app.codeStats 0ms

/src/test/run-pass/box-unbox.rs

http://github.com/jruderman/rust
Rust | 12 lines | 8 code | 4 blank | 0 comment | 1 complexity | 1b9ca10e88e73a464e4b8ffbbada827c MD5 | raw file
 1
 2
 3type box<T: copy> = {c: @T};
 4
 5fn unbox<T: copy>(b: box<T>) -> T { return *b.c; }
 6
 7fn main() {
 8    let foo: int = 17;
 9    let bfoo: box<int> = {c: @foo};
10    debug!{"see what's in our box"};
11    assert (unbox::<int>(bfoo) == foo);
12}