PageRenderTime 11ms CodeModel.GetById 1ms app.highlight 5ms RepoModel.GetById 2ms app.codeStats 0ms

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

http://github.com/jruderman/rust
Rust | 8 lines | 5 code | 3 blank | 0 comment | 1 complexity | dabad80a25ac9c3245001e33de293820 MD5 | raw file
1
2
3fn box<T: copy>(x: {x: T, y: T, z: T}) -> @{x: T, y: T, z: T} { return @x; }
4
5fn main() {
6    let x: @{x: int, y: int, z: int} = box::<int>({x: 1, y: 2, z: 3});
7    assert (x.y == 2);
8}