Skip to content

Instantly share code, notes, and snippets.

Created December 22, 2015 17:58
Show Gist options
  • Save anonymous/02a637bc7d85591b9c63 to your computer and use it in GitHub Desktop.
Save anonymous/02a637bc7d85591b9c63 to your computer and use it in GitHub Desktop.
Shared via Rust Playground
fn main() {
let mut p = get_mut();
for &x in p.iter() {
print!("{} ", x);
}
println!("");
}
fn get_mut<'s>() -> &'s mut Vec<i16> {
let mut x: Vec<i16> = vec![1, 2, 3];
for i in x.iter_mut() {
*i += 1;
}
&mut x
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment