Skip to content

Instantly share code, notes, and snippets.

@mattyhall
Last active August 29, 2015 13:56
Show Gist options
  • Save mattyhall/9237865 to your computer and use it in GitHub Desktop.
Save mattyhall/9237865 to your computer and use it in GitHub Desktop.
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