Struct wasi_common::WasiCtxBuilder

source ·
pub struct WasiCtxBuilder { /* private fields */ }
Expand description

A builder allowing customizable construction of WasiCtx instances.

Implementations§

source§

impl WasiCtxBuilder

source

pub fn new() -> Result<Self, Error>

Builder for a new WasiCtx.

source

pub fn args<S: AsRef<str>>( self, args: impl Iterator<Item = S>, ) -> Result<Self, Error>

Add arguments to the command-line arguments list.

source

pub fn arg(self, arg: &str) -> Result<Self, Error>

Add an argument to the command-line arguments list.

source

pub fn inherit_args(self) -> Result<Self, Error>

Inherit the command-line arguments from the host process.

source

pub fn inherit_stdio(self) -> Result<Self, Error>

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

source

pub fn inherit_env(self) -> Result<Self, Error>

Inherit the environment variables from the host process.

source

pub fn env<S: AsRef<str>>(self, k: S, v: S) -> Result<Self, Error>

Add an entry to the environment.

source

pub fn envs<S: AsRef<str>, T: Borrow<(S, S)>>( self, envs: impl Iterator<Item = T>, ) -> Result<Self, Error>

Add entries to the environment.

source

pub fn preopened_dir<P: AsRef<Path>>(self, dir: File, guest_path: P) -> Self

Add a preopened directory.

source

pub fn build(self) -> Result<WasiCtx, Error>

Build a WasiCtx, consuming this WasiCtxBuilder.

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.