MCPcopy Create free account
hub / github.com/bytecodealliance/wasmtime / stdin

Method stdin

crates/wasi/src/ctx.rs:84–87  ·  view source on GitHub ↗

Provides a custom implementation of stdin to use. By default stdin is closed but an example of using the host's native stdin looks like: ``` use wasmtime_wasi::WasiCtx; use wasmtime_wasi::cli::stdin; let mut wasi = WasiCtx::builder(); wasi.stdin(stdin()); ``` Note that inheriting the process's stdin can also be done through [`inherit_stdin`](WasiCtxBuilder::inherit_stdin).

(&mut self, stdin: impl StdinStream + 'static)

Source from the content-addressed store, hash-verified

82 /// Note that inheriting the process's stdin can also be done through
83 /// [`inherit_stdin`](WasiCtxBuilder::inherit_stdin).
84 pub fn stdin(&mut self, stdin: impl StdinStream + 'static) -> &mut Self {
85 self.cli.stdin = Box::new(stdin);
86 self
87 }
88
89 /// Same as [`stdin`](WasiCtxBuilder::stdin), but for stdout.
90 pub fn stdout(&mut self, stdout: impl StdoutStream + 'static) -> &mut Self {

Callers 15

discover_test_binariesFunction · 0.45
assert_outputFunction · 0.45
run_wasmtime_for_outputFunction · 0.45
run_cwasm_from_stdinFunction · 0.45
run_just_stdin_argumentFunction · 0.45
preview2_stdinFunction · 0.45
p2_cli_stdin_emptyFunction · 0.45
p2_cli_stdinFunction · 0.45
p2_cli_splice_stdinFunction · 0.45
runFunction · 0.45
spawnMethod · 0.45
p3_cli_read_stdinFunction · 0.45

Calls 1

newFunction · 0.50

Tested by 14

run_wasmtime_for_outputFunction · 0.36
run_cwasm_from_stdinFunction · 0.36
run_just_stdin_argumentFunction · 0.36
preview2_stdinFunction · 0.36
p2_cli_stdin_emptyFunction · 0.36
p2_cli_stdinFunction · 0.36
p2_cli_splice_stdinFunction · 0.36
runFunction · 0.36
spawnMethod · 0.36
p3_cli_read_stdinFunction · 0.36
p3_cli_stdout_flushFunction · 0.36
wizenFunction · 0.36