Hi folks !
I need to fix the issue:
error[E0521]: borrowed data escapes outside of method
--> src/main.rs:143:32
|
131 | impl<'a> UI<'a> {
| -- lifetime `'a` defined here
...
140 | fn handle_events(&mut self) -> JoinHandle<()> {
| --------- `self` is a reference that is only valid in the method body
...
143 | let characters_modal = Arc::clone(&self._characters_modal);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| |
| `self` escapes the method body here
| argument requires that `'a` must outlive `'static`
I created a minimal sandbox example to reproduce this. Actually it's cropped version of my actual code.
Could somebody help on that to explain why this happens and how to fix this ? I believe "static" lifetime here is not a good choice and should be avoided.