Skip to content

Instantly share code, notes, and snippets.

@JohnMurray
Last active December 12, 2015 10:39
Show Gist options
  • Save JohnMurray/4760447 to your computer and use it in GitHub Desktop.
Save JohnMurray/4760447 to your computer and use it in GitHub Desktop.
simple rust program
struct MyStruct {
mut count : int
}
impl MyStruct {
fn inc(&mut self) -> () { (*self).count += 1; }
}
fn main() -> () {
let STAT : MyStruct = MyStruct { count: 1 };
io::println(int::str(STAT.count));
STAT.inc();
io::println(int::str(STAT.count));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment