Skip to content

How to define the tokio spawn JoinHandle type ? #4284

Answered by Darksonn
fy2462 asked this question in Q&A
Discussion options

You must be logged in to vote

The generic parameter in a JoinHandle is the return type of the task. It is () for tasks that don't return anything. If you don't know what the return type is, you can put any type in the spot and the compiler error will tell you what to put instead.

(It doesn't work when you put Send, but that's because Send is not a type — it's a trait.)

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@fy2462
Comment options

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