Skip to content

Instantly share code, notes, and snippets.

@mattyhall
Last active August 29, 2015 13:56
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
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