/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
- type box<T: copy> = {c: @T};
- fn unbox<T: copy>(b: box<T>) -> T { return *b.c; }
- fn main() {
- let foo: int = 17;
- let bfoo: box<int> = {c: @foo};
- debug!{"see what's in our box"};
- assert (unbox::<int>(bfoo) == foo);
- }