【Rust】 Tokio异步运行时 官方教程中的部分Topic 及select!宏用法
spawn_blocking
spawn_blocking
异步地执行一个同步的代码块或者函数
不同于tokio::spawn(async {...});
,spawn_blocking
会等待直到传入的同步函数完成,spawn
会在主函数结束后中断

#[tokio::main]
These two are the same

Create a runtime
and call block_on
执行在Runtime上的block_on()方法,从而像同步一样执行异步代码
对于以上方法,可以利用block_on
轻易用于同步

Create a runtime
and spawn
things on it
Run the runtime
in a separate thread and send message to it
Graceful Shutdown
figuring out when to shut down
Telling every part of the program to shut down
Waiting for other parts of the program to shut down

Select!宏 例子