MCPcopy Create free account
hub / github.com/bluejekyll/wasmtime-java / new

Method new

wasmtime-jni/src/wasm_state.rs:12–24  ·  view source on GitHub ↗
(_env: JNIEnv<'_>)

Source from the content-addressed store, hash-verified

10
11impl JavaState {
12 pub fn new(_env: JNIEnv<'_>) -> Result<Self, Error> {
13 // TODO: Security considerations here, we don't want to capture the parent processes env
14 // we probably also want custom filehandles for the stdio of the module as well...
15 //
16 // see: https://docs.wasmtime.dev/examples-rust-wasi.html
17 let wasi = WasiCtxBuilder::new()
18 .inherit_stdio()
19 .inherit_args()
20 .context("failed to establish WASI context")?
21 .build();
22
23 Ok(JavaState { wasi })
24 }
25
26 pub fn wasi_mut(&mut self) -> &mut WasiCtx {
27 &mut self.wasi

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected