Struct spin_core::StoreBuilder
source · pub struct StoreBuilder { /* private fields */ }
Expand description
A builder interface for configuring a new Store
.
A new StoreBuilder
can be obtained with crate::Engine::store_builder
.
Implementations§
source§impl StoreBuilder
impl StoreBuilder
sourcepub fn max_memory_size(&mut self, max_memory_size: usize)
pub fn max_memory_size(&mut self, max_memory_size: usize)
Sets a maximum memory allocation limit.
See wasmtime::ResourceLimiter::memory_growing
(maximum
) for
details on how this limit is enforced.
sourcepub fn inherit_stdin(&mut self)
pub fn inherit_stdin(&mut self)
Inherit stdin from the host process.
sourcepub fn stdin_pipe(&mut self, r: impl Read + Send + Sync + 'static)
pub fn stdin_pipe(&mut self, r: impl Read + Send + Sync + 'static)
Sets the WASI stdin
descriptor to the given Read
er.
sourcepub fn inherit_stdout(&mut self)
pub fn inherit_stdout(&mut self)
Inherit stdin from the host process.
sourcepub fn stdout_pipe(&mut self, w: impl Write + Send + Sync + 'static)
pub fn stdout_pipe(&mut self, w: impl Write + Send + Sync + 'static)
Sets the WASI stdout
descriptor to the given Write
er.
sourcepub fn stdout_buffered(&mut self) -> OutputBuffer
pub fn stdout_buffered(&mut self) -> OutputBuffer
Sets the WASI stdout
descriptor to an in-memory buffer which can be
retrieved after execution from the returned OutputBuffer
.
sourcepub fn inherit_stderr(&mut self)
pub fn inherit_stderr(&mut self)
Inherit stdin from the host process.
sourcepub fn stderr_pipe(&mut self, w: impl Write + Send + Sync + 'static)
pub fn stderr_pipe(&mut self, w: impl Write + Send + Sync + 'static)
Sets the WASI stderr
descriptor to the given Write
er.
sourcepub fn stderr_buffered(&mut self) -> OutputBuffer
pub fn stderr_buffered(&mut self) -> OutputBuffer
Sets the WASI stderr
descriptor to an in-memory buffer which can be
retrieved after execution from the returned OutputBuffer
.
sourcepub fn args<'b>(&mut self, args: impl IntoIterator<Item = &'b str>) -> Result<()>
pub fn args<'b>(&mut self, args: impl IntoIterator<Item = &'b str>) -> Result<()>
Appends the given strings to the the WASI ‘args’.
sourcepub fn env(
&mut self,
vars: impl IntoIterator<Item = (impl AsRef<str>, impl AsRef<str>)>
) -> Result<()>
pub fn env(
&mut self,
vars: impl IntoIterator<Item = (impl AsRef<str>, impl AsRef<str>)>
) -> Result<()>
Sets the given key/value string entries on the the WASI ‘env’.
sourcepub fn read_only_preopened_dir(
&mut self,
host_path: impl AsRef<Path>,
guest_path: PathBuf
) -> Result<()>
pub fn read_only_preopened_dir(
&mut self,
host_path: impl AsRef<Path>,
guest_path: PathBuf
) -> Result<()>
“Mounts” the given host_path
into the WASI filesystem at the given
guest_path
with read-only capabilities.
sourcepub fn read_write_preopened_dir(
&mut self,
host_path: impl AsRef<Path>,
guest_path: PathBuf
) -> Result<()>
pub fn read_write_preopened_dir(
&mut self,
host_path: impl AsRef<Path>,
guest_path: PathBuf
) -> Result<()>
“Mounts” the given host_path
into the WASI filesystem at the given
guest_path
with read and write capabilities.
sourcepub fn host_components_data(&mut self) -> &mut HostComponentsData
pub fn host_components_data(&mut self) -> &mut HostComponentsData
Returns a mutable reference to the built
sourcepub fn build_with_data<T>(self, inner_data: T) -> Result<Store<T>>
pub fn build_with_data<T>(self, inner_data: T) -> Result<Store<T>>
Builds a Store
from this builder with given host state data.
If T: Default
, it may be preferable to use StoreBuilder::build
.
Auto Trait Implementations§
impl !RefUnwindSafe for StoreBuilder
impl Send for StoreBuilder
impl !Sync for StoreBuilder
impl Unpin for StoreBuilder
impl !UnwindSafe for StoreBuilder
Blanket Implementations§
§impl<T> GetSetFdFlags for T
impl<T> GetSetFdFlags for T
§fn get_fd_flags(&self) -> Result<FdFlags, Error>where
T: AsFilelike,
fn get_fd_flags(&self) -> Result<FdFlags, Error>where
T: AsFilelike,
self
file descriptor.