Closed tae-soo-kim closed 1 year ago
https://github.com/tokio-rs/website/blob/48e89baca324065d5b608d776dc31f99e5efc1bc/tutorial-code/spawning/src/main.rs#L15C8-L15C8
I am learning Tokio with its tutorial. The tutorial uses an async block which I think is unnecessary:
tokio::spawn(async move { process(socket).await; });
can be simplified into:
tokio::spawn(process(socket));
I'm not quite sure so I opened this issue to confirm this. If this is true, I think it worth explanation in the tutorial. If not, I'd like to know what are the differences between these two.
Indeed, they are the same.
Thanks for confirming this. Adding a note in the tutorial could be helpful for readers.
https://github.com/tokio-rs/website/blob/48e89baca324065d5b608d776dc31f99e5efc1bc/tutorial-code/spawning/src/main.rs#L15C8-L15C8
I am learning Tokio with its tutorial. The tutorial uses an async block which I think is unnecessary:
can be simplified into:
I'm not quite sure so I opened this issue to confirm this. If this is true, I think it worth explanation in the tutorial. If not, I'd like to know what are the differences between these two.