Skip to content

Instantly share code, notes, and snippets.

@oconnor663
Last active February 25, 2024 18:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save oconnor663/b89bbf69d1293c8fa680e183d289c6a6 to your computer and use it in GitHub Desktop.
Save oconnor663/b89bbf69d1293c8fa680e183d289c6a6 to your computer and use it in GitHub Desktop.
A first look at Rust lifetimes
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