Struct wasmtime_wasi::WasiCtxBuilder
source · [−]pub struct WasiCtxBuilder { /* private fields */ }
Expand description
A builder allowing customizable construction of WasiCtx
instances.
Implementations
sourceimpl WasiCtxBuilder
impl WasiCtxBuilder
sourcepub fn new() -> WasiCtxBuilder
pub fn new() -> WasiCtxBuilder
Builder for a new WasiCtx
.
sourcepub fn args<S>(
&mut self,
args: impl IntoIterator<Item = S>
) -> &mut WasiCtxBuilder where
S: AsRef<[u8]>,
pub fn args<S>(
&mut self,
args: impl IntoIterator<Item = S>
) -> &mut WasiCtxBuilder where
S: AsRef<[u8]>,
Add arguments to the command-line arguments list.
Arguments must be valid UTF-8 with no NUL bytes, or else WasiCtxBuilder::build()
will fail.
sourcepub fn arg<S>(&mut self, arg: S) -> &mut WasiCtxBuilder where
S: AsRef<[u8]>,
pub fn arg<S>(&mut self, arg: S) -> &mut WasiCtxBuilder where
S: AsRef<[u8]>,
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.
sourcepub fn inherit_args(&mut self) -> &mut WasiCtxBuilder
pub fn inherit_args(&mut self) -> &mut WasiCtxBuilder
Inherit the command-line arguments from the host process.
If any arguments from the host process contain invalid UTF-8, WasiCtxBuilder::build()
will
fail.
sourcepub fn inherit_stdin(&mut self) -> &mut WasiCtxBuilder
pub fn inherit_stdin(&mut self) -> &mut WasiCtxBuilder
Inherit stdin from the host process.
sourcepub fn inherit_stdout(&mut self) -> &mut WasiCtxBuilder
pub fn inherit_stdout(&mut self) -> &mut WasiCtxBuilder
Inherit stdout from the host process.
sourcepub fn inherit_stderr(&mut self) -> &mut WasiCtxBuilder
pub fn inherit_stderr(&mut self) -> &mut WasiCtxBuilder
Inherit stderr from the host process.
sourcepub fn inherit_stdio(&mut self) -> &mut WasiCtxBuilder
pub fn inherit_stdio(&mut self) -> &mut WasiCtxBuilder
Inherit the stdin, stdout, and stderr streams from the host process.
sourcepub fn inherit_env(&mut self) -> &mut WasiCtxBuilder
pub fn inherit_env(&mut self) -> &mut WasiCtxBuilder
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.
sourcepub fn env<S>(&mut self, k: S, v: S) -> &mut WasiCtxBuilder where
S: AsRef<[u8]>,
pub fn env<S>(&mut self, k: S, v: S) -> &mut WasiCtxBuilder where
S: AsRef<[u8]>,
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.
sourcepub fn envs<S, T>(
&mut self,
envs: impl IntoIterator<Item = T>
) -> &mut WasiCtxBuilder where
S: AsRef<[u8]>,
T: Borrow<(S, S)>,
pub fn envs<S, T>(
&mut self,
envs: impl IntoIterator<Item = T>
) -> &mut WasiCtxBuilder where
S: AsRef<[u8]>,
T: Borrow<(S, S)>,
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.
sourcepub fn stdin<T>(&mut self, handle: T) -> &mut WasiCtxBuilder where
T: 'static + Handle,
pub fn stdin<T>(&mut self, handle: T) -> &mut WasiCtxBuilder where
T: 'static + Handle,
Provide a Handle
to use as stdin
sourcepub fn stdout<T>(&mut self, handle: T) -> &mut WasiCtxBuilder where
T: 'static + Handle,
pub fn stdout<T>(&mut self, handle: T) -> &mut WasiCtxBuilder where
T: 'static + Handle,
Provide a Handle
to use as stdout
sourcepub fn stderr<T>(&mut self, handle: T) -> &mut WasiCtxBuilder where
T: 'static + Handle,
pub fn stderr<T>(&mut self, handle: T) -> &mut WasiCtxBuilder where
T: 'static + Handle,
Provide a Handle
to use as stderr
sourcepub fn preopened_dir<P>(
&mut self,
dir: File,
guest_path: P
) -> &mut WasiCtxBuilder where
P: AsRef<Path>,
pub fn preopened_dir<P>(
&mut self,
dir: File,
guest_path: P
) -> &mut WasiCtxBuilder where
P: AsRef<Path>,
Add a preopened directory.
sourcepub fn preopened_virt<P>(
&mut self,
dir: VirtualDirEntry,
guest_path: P
) -> &mut WasiCtxBuilder where
P: AsRef<Path>,
pub fn preopened_virt<P>(
&mut self,
dir: VirtualDirEntry,
guest_path: P
) -> &mut WasiCtxBuilder where
P: AsRef<Path>,
Add a preopened virtual directory.
sourcepub fn build(&mut self) -> Result<WasiCtx, WasiCtxBuilderError>
pub fn build(&mut self) -> Result<WasiCtx, WasiCtxBuilderError>
Build a WasiCtx
, consuming this WasiCtxBuilder
.
If any of the arguments or environment variables in this builder cannot be converted into
CString
s, either due to NUL bytes or Unicode conversions, this will fail.
Auto Trait Implementations
impl !RefUnwindSafe for WasiCtxBuilder
impl !Send for WasiCtxBuilder
impl !Sync for WasiCtxBuilder
impl Unpin for WasiCtxBuilder
impl !UnwindSafe for WasiCtxBuilder
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more