fix wasmtime doctest

This commit is contained in:
Pat Hickey
2021-02-01 19:12:20 -08:00
parent 544a491639
commit ca657186f2
3 changed files with 5 additions and 2 deletions

1
Cargo.lock generated
View File

@@ -3216,6 +3216,7 @@ dependencies = [
"smallvec",
"target-lexicon",
"tempfile",
"wasi-cap-std-sync",
"wasmparser",
"wasmtime-cache",
"wasmtime-environ",

View File

@@ -37,6 +37,7 @@ winapi = "0.3.7"
[dev-dependencies]
tempfile = "3.0"
wasmtime-wasi = { path = "../wasi" }
wasi-cap-std-sync = { path = "../wasi-common/cap-std-sync" }
[badges]
maintenance = { status = "actively-developed" }

View File

@@ -153,7 +153,8 @@
//! ```no_run
//! # use anyhow::Result;
//! # use wasmtime::*;
//! use wasmtime_wasi::{Wasi, WasiCtx};
//! use wasmtime_wasi::Wasi;
//! use wasi_cap_std_sync::WasiCtxBuilder;
//!
//! # fn main() -> Result<()> {
//! let store = Store::default();
@@ -162,7 +163,7 @@
//! // Create an instance of `Wasi` which contains a `WasiCtx`. Note that
//! // `WasiCtx` provides a number of ways to configure what the target program
//! // will have access to.
//! let wasi = Wasi::new(&store, WasiCtx::new(std::env::args())?);
//! let wasi = Wasi::new(&store, WasiCtxBuilder::new().inherit_stdio().build()?);
//! wasi.add_to_linker(&mut linker)?;
//!
//! // Instantiate our module with the imports we've created, and run it.