518dc52f85
This changes the indexing syntax from .() to [], the vector syntax from ~[] to [] and the extension syntax from #fmt() to #fmt[]
10 lines
233 B
Rust
10 lines
233 B
Rust
resource finish<T>(arg: {val: T, fin: fn(&T)}) { arg.fin(arg.val); }
|
|
|
|
fn main() {
|
|
let box = @mutable 10;
|
|
fn dec_box(i: &@mutable int) { *i -= 1; }
|
|
|
|
{ let i <- finish({val: box, fin: dec_box}); }
|
|
assert (*box == 9);
|
|
}
|