update wasi README.md
This commit is contained in:
@@ -1,8 +1,10 @@
|
|||||||
|
|
||||||
|
Prepare:
|
||||||
```shell
|
```shell
|
||||||
rustup target add wasm32-wasi
|
rustup target add wasm32-wasi
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Compile:
|
||||||
```shell
|
```shell
|
||||||
cargo build --target=wasm32-wasi
|
cargo build --target=wasm32-wasi
|
||||||
```
|
```
|
||||||
@@ -14,11 +16,9 @@ debug wasm32-wasi
|
|||||||
|
|
||||||
|
|
||||||
运行时(Runtime)
|
运行时(Runtime)
|
||||||
运行这个文件,需要一个运行时(Runtime)。你也可以把这个理解成一个“容器”,“虚拟机”什么的,都行。但是准确的叫法是:运行时。
|
> 运行这个文件,需要一个运行时(Runtime)。你也可以把这个理解成一个“容器”,“虚拟机”什么的,都行。但是准确的叫法是:运行时。
|
||||||
|
> 目前常见的运行时有 wasmtime,wasmer 等。
|
||||||
目前常见的运行时有 wasmtime,wasmer 等。
|
> 我们这次用 wasmtime 来运行吧。
|
||||||
|
|
||||||
我们这次用 wasmtime 来运行吧。
|
|
||||||
|
|
||||||
`curl https://wasmtime.dev/install.sh -sSf | bash`
|
`curl https://wasmtime.dev/install.sh -sSf | bash`
|
||||||
|
|
||||||
@@ -27,12 +27,15 @@ or download from:
|
|||||||
https://github.com/bytecodealliance/wasmtime/releases
|
https://github.com/bytecodealliance/wasmtime/releases
|
||||||
|
|
||||||
|
|
||||||
|
Run:
|
||||||
```
|
```
|
||||||
$ wasmtime --dir=. target/wasm32-wasi/debug/wasi.wasm
|
$ wasmtime --dir=. target/wasm32-wasi/debug/wasi.wasm
|
||||||
Hello, world!
|
Hello, world!
|
||||||
```
|
```
|
||||||
|
|
||||||
|
<br>
|
||||||
|
|
||||||
|
Reference:
|
||||||
|
|
||||||
https://mp.weixin.qq.com/s/VYkUvD1NpRdx_qoIdCCq8w - _【Rust每周一知】Rust, wasm, wasi 试玩儿_
|
https://mp.weixin.qq.com/s/VYkUvD1NpRdx_qoIdCCq8w - _【Rust每周一知】Rust, wasm, wasi 试玩儿_
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user