Lifetime problem when using functions

I am trying to speed up my program by using reference instead of cloning structs.
But I understand that 'a must live along with launch function, but I don't know how to resolve the problem without sacrifying speed.
I need &mut : it works perfectly with immutable...

Thank you in advance for your help.

&'a mut self when 'a appears in the type you're implement is never a good idea and will always fail to compile. From your struct definition it seems you're trying to have a field reference another field: this is called a self-referential struct and is not possible in safe rust. Consider using indexes instead, or split your struct in two.


This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.