Lifetimes

In Rust, lifetimes are the mechanism by which the Rust compiler can reason about the logic of your program. Lifetimes are denoted by a quote followed by an identifier, which is typically one letter - for example. Lifetimes behave similarly to types, but come with a few important differences:


 * Lifetimes are always anonymous. This means that they can be referred to from generic lifetime parameters - there's no such thing as a concrete lifetime.
 * Lifetimes can often be elided - most of the time  can be replaced with   or even just  . Type parameters on the other hand must always be specified.
 * Lifetimes do not have any direct correspondance with a the resulting binary of the program like types do - they exist only in the compiler.


 * See the Lifetime elision RFC for more details on lifetime elision.
 * Read Validating References with Lifetimes in "The Rust Programming Language" for more information on lifetimes.