Struct wasmer_wasi::WasiState[][src]

pub struct WasiState {
    pub fs: WasiFs,
    pub args: Vec<Vec<u8>>,
    pub envs: Vec<Vec<u8>>,
}
Expand description

Top level data type containing all* the state with which WASI can interact.

  • The contents of files are not stored and may be modified by other, concurrently running programs. Data such as the contents of directories are lazily loaded.

Usage:

WasiState::new("program_name")
   .env(b"HOME", "/home/home".to_string())
   .arg("--help")
   .envs({
       let mut hm = std::collections::HashMap::new();
       hm.insert("COLOR_OUTPUT", "TRUE");
       hm.insert("PATH", "/usr/bin");
       hm
   })
   .args(&["--verbose", "list"])
   .preopen(|p| p.directory("src").read(true).write(true).create(true))?
   .preopen(|p| p.directory(".").alias("dot").read(true))?
   .build()?;

Fields

fs: WasiFsargs: Vec<Vec<u8>>envs: Vec<Vec<u8>>

Implementations

Create a WasiStateBuilder to construct a validated instance of WasiState.

Trait Implementations

Formats the value using the given formatter. 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

Deserializes using the given deserializer

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 alignment of pointer.

The type for initializers.

Initializes a with the given initializer. Read more

Dereferences the given pointer. Read more

Mutably dereferences the given pointer. Read more

Drops the object pointed to by the given pointer. Read more

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