Last active
December 16, 2015 16:29
-
-
Save grahamking/5463592 to your computer and use it in GitHub Desktop.
rust question
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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