Skip to content

Instantly share code, notes, and snippets.

@grahamking
Last active December 16, 2015 16:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save grahamking/5463592 to your computer and use it in GitHub Desktop.
Save grahamking/5463592 to your computer and use it in GitHub Desktop.
rust question
struct Point {
x: int,
y: int
}
fn one() {
let mut a = ~Point{x: 10, y: 20};
a.x = 42;
println(a.x.to_str());
}
fn two() {
let a = @mut Point{x: 10, y: 20};
a.x = 42;
println(a.x.to_str());
}
fn main() {
one();
two();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment