[−][src]Struct wasi_common::WasiCtxBuilder
A builder allowing customizable construction of WasiCtx
instances.
Methods
impl WasiCtxBuilder
[src]
pub fn new() -> Self
[src]
Builder for a new WasiCtx
.
pub fn args<S: AsRef<[u8]>>(
&mut self,
args: impl IntoIterator<Item = S>
) -> &mut Self
[src]
&mut self,
args: impl IntoIterator<Item = S>
) -> &mut Self
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: AsRef<[u8]>>(&mut self, arg: S) -> &mut Self
[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 Self
[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 Self
[src]
Inherit stdin from the host process.
pub fn inherit_stdout(&mut self) -> &mut Self
[src]
Inherit stdout from the host process.
pub fn inherit_stderr(&mut self) -> &mut Self
[src]
Inherit stdout from the host process.
pub fn inherit_stdio(&mut self) -> &mut Self
[src]
Inherit the stdin, stdout, and stderr streams from the host process.
pub fn inherit_env(&mut self) -> &mut Self
[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: AsRef<[u8]>>(&mut self, k: S, v: S) -> &mut Self
[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: AsRef<[u8]>, T: Borrow<(S, S)>>(
&mut self,
envs: impl IntoIterator<Item = T>
) -> &mut Self
[src]
&mut self,
envs: impl IntoIterator<Item = T>
) -> &mut Self
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(&mut self, file: File) -> &mut Self
[src]
Provide a File to use as stdin
pub fn stdout(&mut self, file: File) -> &mut Self
[src]
Provide a File to use as stdout
pub fn stderr(&mut self, file: File) -> &mut Self
[src]
Provide a File to use as stderr
pub fn preopened_dir<P: AsRef<Path>>(
&mut self,
dir: File,
guest_path: P
) -> &mut Self
[src]
&mut self,
dir: File,
guest_path: P
) -> &mut Self
Add a preopened directory.
pub fn preopened_virt<P: AsRef<Path>>(
&mut self,
dir: VirtualDirEntry,
guest_path: P
) -> &mut Self
[src]
&mut self,
dir: VirtualDirEntry,
guest_path: P
) -> &mut Self
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
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
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Pointee for T
[src]
type Pointer = u32
fn debug(
pointer: <T as Pointee>::Pointer,
f: &mut Formatter
) -> Result<(), Error>
[src]
pointer: <T as Pointee>::Pointer,
f: &mut Formatter
) -> Result<(), Error>
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,