I really like the section of "Thinking in Scopes" in the Book that describes this:
https://doc.rust-lang.org/book/first-edition/lifetimes.html#...
You can think of lifetimes as hidden variables defined by the compiler that are in a sense bound to some block of code. I find this to be the best way to think of them personally.
I really like the section of "Thinking in Scopes" in the Book that describes this:
https://doc.rust-lang.org/book/first-edition/lifetimes.html#...
You can think of lifetimes as hidden variables defined by the compiler that are in a sense bound to some block of code. I find this to be the best way to think of them personally.