Last active
August 29, 2015 13:56
-
-
Save mattyhall/9237865 to your computer and use it in GitHub Desktop.
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 TestData { | |
x: int | |
} | |
impl TestData { | |
pub fn addition(&mut self) { | |
self.x += 10; | |
} | |
} | |
// I would like to do something like this: | |
let v = ~[TestData{x: 1}]; | |
for data in v.iter() { | |
v.addition(); | |
} | |
// but iter does not seem to give mutable values. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment