Browse the docs

silk.platform.wasi.host_input.

A snapshot of WASI command arguments and environment variables.

When to use#

Use WasiHostInput.capture to provide HostInput inside a WASI command. The WASI runtime supplies this provider to an application that requires HostInput.

Details#

The snapshot owns its bytes. The working directory is / in the guest namespace. The host grants filesystem access separately through preopened directories.

Import as WasiHostInput with import silk.platform.wasi.host_input { WasiHostInput }.

Public declarations: 1.

WasiHostInput#

silk
pub struct WasiHostInput

A WASI HostInput provider that owns command arguments and environment bytes. The working directory is / in the guest namespace.

Implementation WasiHostInput#

silk
impl WasiHostInput

Associated function capture#

silk
pub effect fn capture() -> WasiHostInput
      ! HostInputError | OutOfMemoryError
      ? &mut Allocator

Copies the host's command arguments and environment into an owned snapshot. Fails with HostInputError on a host error, or OutOfMemoryError on an allocation failure.

Implementation HostInput for WasiHostInput#

silk
impl HostInput for WasiHostInput

Operation argumentCount#

silk
effect fn argumentCount(self: &mut Self) -> usize
      ! HostInputError

Operation argument#

silk
effect fn argument(self: &mut Self, index: usize) -> Option<Bytes>
      ! HostInputError | OutOfMemoryError
      ? &mut Allocator

Operation variable#

silk
effect fn variable(self: &mut Self, name: &[u8]) -> Option<Bytes>
      ! HostInputError | OutOfMemoryError
      ? &mut Allocator

Operation workingDirectory#

silk
effect fn workingDirectory(self: &mut Self) -> Bytes
      ! HostInputError | OutOfMemoryError
      ? &mut Allocator

Category: Native platform.

Profiles: wasm32-wasip1, wasm32-wasip2.

View the source of this page