add tokio example
Co-authored-by: Alex Crichton <alex@alexcrichton.com>
This commit is contained in:
10
examples/tokio/wasm/Cargo.toml
Normal file
10
examples/tokio/wasm/Cargo.toml
Normal file
@@ -0,0 +1,10 @@
|
||||
[package]
|
||||
name = "example-tokio-wasm"
|
||||
version = "0.0.0"
|
||||
authors = ["The Wasmtime Project Developers"]
|
||||
edition = "2018"
|
||||
publish = false
|
||||
|
||||
[[bin]]
|
||||
path = "tokio-wasi.rs"
|
||||
name = "tokio-wasi"
|
||||
6
examples/tokio/wasm/tokio-wasi.rs
Normal file
6
examples/tokio/wasm/tokio-wasi.rs
Normal file
@@ -0,0 +1,6 @@
|
||||
fn main() {
|
||||
let name = std::env::var("NAME").unwrap();
|
||||
println!("Hello, world! My name is {}", name);
|
||||
std::thread::sleep(std::time::Duration::from_secs(1));
|
||||
println!("Goodbye from {}", name);
|
||||
}
|
||||
Reference in New Issue
Block a user