Created
March 26, 2018 12:39
-
-
Save CodeSandwich/558cbfc3ea09e6e2de9d2b97ffc9bac8 to your computer and use it in GitHub Desktop.
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 valid_flow() { | |
let value = "abc".to_string(); // crate value | |
let borrow = &value; // create borrow | |
println!("{}", value); // use value without moving it | |
println!("{}", borrow); // use borrow | |
// delete borrow | |
// delete value safely, because | |
// it's no longer borrowed | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment