Example
impl<'a> Type<'a> {
fn my_function(&self) -> &'a u32 {
self.x
}
}
This specifies that Type
has lifetime 'a
, and that the reference returned by my_function()
may no longer be valid after 'a
ends because the Type
no longer exists to hold self.x
.