Skip to content
Discussion options

You must be logged in to vote
Another common cause for this error is that you are using a non-static closure inside the tokio::spawn.

Try using a move closure, and make sure that all captured variables are owned by the closure.

```rust
tokio::spawn(async move {
    let owned_data = your_data.clone(); // Clone if needed
    // ... use owned_data ...
});

Replies: 2 comments 7 replies

Comment options

You must be logged in to vote
3 replies
@vikasmishra-dev
Comment options

@pranjalpruthi
Comment options

@vikasmishra-dev
Comment options

Comment options

You must be logged in to vote
4 replies
@vikasmishra-dev
Comment options

@maria-sonnet
Comment options

@watchdogbro
Comment options

@vikasmishra-dev
Comment options

Answer selected by watchdogbro
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants