I have a member of a struct (not a reference) and it contains (or will when I get the syntax sorted) a reference so needs lifetime annotations (according to the compiler)
struct A {
b:B, // <-- What do I say here?
}
struct B<'a> {
foo:&'a SomeThingElse,
}
impl<'a> B<'a> { // Not sure about this....:
:
}
I am very frustrated with life times.
I understand why they are needed, but the syntax eludes me each and every time. There is no documentation for them that is not full of prose. And when I refactor the code not to use references I cannot leave the life time annotations there if they are not used so I have to re learn them every time.
The following is not what I am looking for....
What I do need is a list of all the syntax where life times may be used.
Asking about lifetimes on this forum a very common answer is "just avoid them". I can. By copying and cloning, but that defeats the point of Rust