feat: add README.md

This commit is contained in:
2022-03-19 23:45:47 +08:00
parent 7007a77334
commit cbb8f43ad3
2 changed files with 32 additions and 0 deletions

View File

@@ -0,0 +1,22 @@
Import `tokio`:
```
tokio = { version = "1.0", features = ["full"] }
```
Usage:
```rust
#[tokio::main]
async fn main() {
// TODO ...
}
```
`tokio` 提供以下几种 channels 类型:
* mpsc: 多生产者,单消费者 - https://docs.rs/tokio/1/tokio/sync/mpsc/index.html
* oneshot: 单生产者,单消费者 - https://docs.rs/tokio/1/tokio/sync/oneshot/index.html
* broadcast: 多生产者,多消费者 - https://docs.rs/tokio/1/tokio/sync/broadcast/index.html
* watch: 单生产者,多消费者 - https://docs.rs/tokio/1/tokio/sync/watch/index.html

View File

@@ -0,0 +1,10 @@
fn main() {
let rt = tokio::runtime::Runtime::new().unwrap();
rt.block_on(async {
invoke().await
});
}
async fn invoke() {
println!("Hello World!");
}