Struct wasmer_wasi_asml_fork::WasiStateBuilder [−][src]
pub struct WasiStateBuilder { /* fields omitted */ }
Expand description
Convenient builder API for configuring WASI via WasiState
.
Usage:
let mut state_builder = WasiState::new("wasi-prog-name");
state_builder
.env("ENV_VAR", "ENV_VAL")
.arg("--verbose")
.preopen_dir("src")?
.map_dir("name_wasi_sees", "path/on/host/fs")?
.build();
Implementations
Add an environment variable pair.
Both the key and value of an environment variable must not
contain a nul byte (0x0
), and the key must not contain the
=
byte (0x3d
).
Add an argument.
Arguments must not contain the nul (0x0) byte
Add multiple environment variable pairs.
Both the key and value of the environment variables must not
contain a nul byte (0x0
), and the key must not contain the
=
byte (0x3d
).
Add multiple arguments.
Arguments must not contain the nul (0x0) byte
pub fn preopen_dir<FilePath>(
&mut self,
po_dir: FilePath
) -> Result<&mut Self, WasiStateCreationError> where
FilePath: AsRef<Path>,
pub fn preopen_dir<FilePath>(
&mut self,
po_dir: FilePath
) -> Result<&mut Self, WasiStateCreationError> where
FilePath: AsRef<Path>,
Preopen a directory
This opens the given directory at the virtual root, /
, and allows
the WASI module to read and write to the given directory.
Preopen a directory and configure it.
Usage:
WasiState::new("program_name")
.preopen(|p| p.directory("src").read(true).write(true).create(true))?
.preopen(|p| p.directory(".").alias("dot").read(true))?
.build()?;
pub fn preopen_dirs<I, FilePath>(
&mut self,
po_dirs: I
) -> Result<&mut Self, WasiStateCreationError> where
I: IntoIterator<Item = FilePath>,
FilePath: AsRef<Path>,
pub fn preopen_dirs<I, FilePath>(
&mut self,
po_dirs: I
) -> Result<&mut Self, WasiStateCreationError> where
I: IntoIterator<Item = FilePath>,
FilePath: AsRef<Path>,
Preopen a directory.
This opens the given directory at the virtual root, /
, and allows
the WASI module to read and write to the given directory.
Preopen a directory with a different name exposed to the WASI.
Preopen directorys with a different names exposed to the WASI.
Overwrite the default WASI stdout
, if you want to hold on to the
original stdout
use WasiFs::swap_file
after building.
Overwrite the default WASI stderr
, if you want to hold on to the
original stderr
use WasiFs::swap_file
after building.
Overwrite the default WASI stdin
, if you want to hold on to the
original stdin
use WasiFs::swap_file
after building.
Setup the WASI filesystem before running
Consumes the WasiStateBuilder
and produces a WasiState
Returns the error from WasiFs::new
if there’s an error
Consumes the WasiStateBuilder
and produces a WasiEnv
Returns the error from WasiFs::new
if there’s an error
Trait Implementations
Returns the “default value” for a type. Read more
Auto Trait Implementations
impl !RefUnwindSafe for WasiStateBuilder
impl Send for WasiStateBuilder
impl !Sync for WasiStateBuilder
impl Unpin for WasiStateBuilder
impl !UnwindSafe for WasiStateBuilder
Blanket Implementations
type ArchivedMetadata = ()
type ArchivedMetadata = ()
The archived version of the pointer metadata for this type.
pub fn pointer_metadata(
&<T as ArchivePointee>::ArchivedMetadata
) -> <T as Pointee>::Metadata
pub fn pointer_metadata(
&<T as ArchivePointee>::ArchivedMetadata
) -> <T as Pointee>::Metadata
Converts some archived metadata to the pointer metadata for itself.
Mutably borrows from an owned value. Read more
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more