Struct wasmer_wasi_asml_fork::WasiStateBuilder[][src]

pub struct WasiStateBuilder { /* fields omitted */ }
Expand description

Convenient builder API for configuring WASI via WasiState.

Usage:

let mut state_builder = WasiState::new("wasi-prog-name");
state_builder
   .env("ENV_VAR", "ENV_VAL")
   .arg("--verbose")
   .preopen_dir("src")?
   .map_dir("name_wasi_sees", "path/on/host/fs")?
   .build();

Implementations

Add an environment variable pair.

Both the key and value of an environment variable must not contain a nul byte (0x0), and the key must not contain the = byte (0x3d).

Add an argument.

Arguments must not contain the nul (0x0) byte

Add multiple environment variable pairs.

Both the key and value of the environment variables must not contain a nul byte (0x0), and the key must not contain the = byte (0x3d).

Add multiple arguments.

Arguments must not contain the nul (0x0) byte

Preopen a directory

This opens the given directory at the virtual root, /, and allows the WASI module to read and write to the given directory.

Preopen a directory and configure it.

Usage:

WasiState::new("program_name")
   .preopen(|p| p.directory("src").read(true).write(true).create(true))?
   .preopen(|p| p.directory(".").alias("dot").read(true))?
   .build()?;

Preopen a directory.

This opens the given directory at the virtual root, /, and allows the WASI module to read and write to the given directory.

Preopen a directory with a different name exposed to the WASI.

Preopen directorys with a different names exposed to the WASI.

Overwrite the default WASI stdout, if you want to hold on to the original stdout use WasiFs::swap_file after building.

Overwrite the default WASI stderr, if you want to hold on to the original stderr use WasiFs::swap_file after building.

Overwrite the default WASI stdin, if you want to hold on to the original stdin use WasiFs::swap_file after building.

Setup the WASI filesystem before running

Consumes the WasiStateBuilder and produces a WasiState

Returns the error from WasiFs::new if there’s an error

Consumes the WasiStateBuilder and produces a WasiEnv

Returns the error from WasiFs::new if there’s an error

Trait Implementations

Formats the value using the given formatter. Read more

Returns the “default value” for a type. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

The archived version of the pointer metadata for this type.

Converts some archived metadata to the pointer metadata for itself.

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Performs the conversion.

The type for metadata in pointers and references to Self.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more