I apologize in advance if the code seems confusing or complex for no apparent reason: this is just a minimal example compared to the real code (which is much more complex and bigger).
I would like to understand why this error:
error: `impl Executor` does not live long enough
--> src/main.rs:136:5
|
136 | / async move {
137 | | dbg!("I'm:", user);
138 | |
139 | | let mut store = store.unwrap_or_default();
... |
169 | | }
170 | | .boxed()
| |____________^
The reason I'm using the trait Executor is because I need to use both DB connections and transactions in my services layer (represented here by team_list).
I can change everything in this code, the trait too.
I have tested and found that the db.as_executor() passed in when calling fetch_all caused the lifetime check to fail.
Is it because of the lifetime 'this defined in the associated type, or because of the lifetime restriction in sqlx::executor::Executor<'c> ? Thank you for your reply