Last active
February 25, 2024 18:49
-
-
Save oconnor663/b89bbf69d1293c8fa680e183d289c6a6 to your computer and use it in GitHub Desktop.
A first look at Rust lifetimes
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 main() { | |
let my_string = String::from("foo"); | |
let mut my_vec = Vec::<&String>::new(); | |
my_vec.push(&my_string); | |
// drop(my_string); | |
println!("{:?}", my_vec); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment