(Every statement marked with ? wishes to be asserted)
I'm just coming along with lifetimes slowly.
As lifetime elision helps to omit explicitly describing a lifetime(?) there are cases where we need to describe them.
An example might be a struct which holds a reference:
struct Person<a'>{
car: &'a Car
}
Am I right with the following assumption that,
a struct is a value type - therefore its memory lies on the stack. After the scope ends where this struct is used in - the struct will die. But since this struct holds a reference to a Car and this reference might be borrowed to somewhere else - the struct NEEDS to stay alive as long as the Car reference is in use. The Lifetime 'a therefore tells the Person struct to stay alive as long as Car is in use.(?)
to be honest I don't believe myself with this statement above. Because in other definitions of the rust lifetime I understood it so - that the Car needs to stay alive at least as long as 'a so Person won't have a dangling pointer.