Last active
August 29, 2015 14:21
-
-
Save Pusungwi/4979090ef269e94490bd to your computer and use it in GitHub Desktop.
Take ownership example
This file contains hidden or 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
fn take(v : Vec<i32>) { | |
//take ownership | |
} | |
fn main() { | |
let v = vec![1, 2, 3]; | |
take(v); | |
println!("v[0] is {}", v[0]); // <- ERROR | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment