Skip to content

Instantly share code, notes, and snippets.

@dumindu
Last active January 8, 2017 10:45
Show Gist options
  • Save dumindu/18c6794b4ff53c375615 to your computer and use it in GitHub Desktop.
Save dumindu/18c6794b4ff53c375615 to your computer and use it in GitHub Desktop.
let mut v = vec![1, 2, 3, 4, 5];
for i in &v {
println!("A reference to {}", i);
}
for i in &mut v {
println!("A mutable reference to {}", i);
}
for i in v {
println!("Take ownership of the vector and its element {}", i);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment