[][src]Struct wasmtime_wasi::WasiCtxBuilder

pub struct WasiCtxBuilder { /* fields omitted */ }

A builder allowing customizable construction of WasiCtx instances.

Implementations

impl WasiCtxBuilder[src]

pub fn new() -> WasiCtxBuilder[src]

Builder for a new WasiCtx.

pub fn args<S>(
    &mut self,
    args: impl IntoIterator<Item = S>
) -> &mut WasiCtxBuilder where
    S: AsRef<[u8]>, 
[src]

Add arguments to the command-line arguments list.

Arguments must be valid UTF-8 with no NUL bytes, or else WasiCtxBuilder::build() will fail.

pub fn arg<S>(&mut self, arg: S) -> &mut WasiCtxBuilder where
    S: AsRef<[u8]>, 
[src]

Add an argument to the command-line arguments list.

Arguments must be valid UTF-8 with no NUL bytes, or else WasiCtxBuilder::build() will fail.

pub fn inherit_args(&mut self) -> &mut WasiCtxBuilder[src]

Inherit the command-line arguments from the host process.

If any arguments from the host process contain invalid UTF-8, WasiCtxBuilder::build() will fail.

pub fn inherit_stdin(&mut self) -> &mut WasiCtxBuilder[src]

Inherit stdin from the host process.

pub fn inherit_stdout(&mut self) -> &mut WasiCtxBuilder[src]

Inherit stdout from the host process.

pub fn inherit_stderr(&mut self) -> &mut WasiCtxBuilder[src]

Inherit stderr from the host process.

pub fn inherit_stdio(&mut self) -> &mut WasiCtxBuilder[src]

Inherit the stdin, stdout, and stderr streams from the host process.

pub fn inherit_env(&mut self) -> &mut WasiCtxBuilder[src]

Inherit the environment variables from the host process.

If any environment variables from the host process contain invalid Unicode (UTF-16 for Windows, UTF-8 for other platforms), WasiCtxBuilder::build() will fail.

pub fn env<S>(&mut self, k: S, v: S) -> &mut WasiCtxBuilder where
    S: AsRef<[u8]>, 
[src]

Add an entry to the environment.

Environment variable keys and values must be valid UTF-8 with no NUL bytes, or else WasiCtxBuilder::build() will fail.

pub fn envs<S, T>(
    &mut self,
    envs: impl IntoIterator<Item = T>
) -> &mut WasiCtxBuilder where
    S: AsRef<[u8]>,
    T: Borrow<(S, S)>, 
[src]

Add entries to the environment.

Environment variable keys and values must be valid UTF-8 with no NUL bytes, or else WasiCtxBuilder::build() will fail.

pub fn stdin<T>(&mut self, handle: T) -> &mut WasiCtxBuilder where
    T: 'static + Handle
[src]

Provide a Handle to use as stdin

pub fn stdout<T>(&mut self, handle: T) -> &mut WasiCtxBuilder where
    T: 'static + Handle
[src]

Provide a Handle to use as stdout

pub fn stderr<T>(&mut self, handle: T) -> &mut WasiCtxBuilder where
    T: 'static + Handle
[src]

Provide a Handle to use as stderr

pub fn preopened_dir<P>(
    &mut self,
    dir: File,
    guest_path: P
) -> &mut WasiCtxBuilder where
    P: AsRef<Path>, 
[src]

Add a preopened directory.

pub fn preopened_virt<P>(
    &mut self,
    dir: VirtualDirEntry,
    guest_path: P
) -> &mut WasiCtxBuilder where
    P: AsRef<Path>, 
[src]

Add a preopened virtual directory.

pub fn build(&mut self) -> Result<WasiCtx, WasiCtxBuilderError>[src]

Build a WasiCtx, consuming this WasiCtxBuilder.

If any of the arguments or environment variables in this builder cannot be converted into CStrings, either due to NUL bytes or Unicode conversions, this will fail.

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T> Instrument for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Pointee for T[src]

type Pointer = u32

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.