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 insert_ip_net_port_range(
&mut self,
ip_net: IpNet,
ports_start: u16,
ports_end: Option<u16>
)
pub fn insert_ip_net_port_range( &mut self, ip_net: IpNet, ports_start: u16, ports_end: Option<u16> )
Insert IP network with a given port range
sourcepub fn inherit_limited_network(&mut self)
pub fn inherit_limited_network(&mut self)
Inherit the host network with a few hardcoded caveats
sourcepub fn stdin_pipe(
&mut self,
r: impl AsyncRead + Read + ReadReady + Send + Sync + Unpin + 'static
)
pub fn stdin_pipe( &mut self, r: impl AsyncRead + Read + ReadReady + Send + Sync + Unpin + '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(&mut self, w: Box<dyn WasiFile>) -> Result<()>
pub fn stdout(&mut self, w: Box<dyn WasiFile>) -> Result<()>
Sets the WASI stdout
descriptor to the given Write
er.
sourcepub fn stdout_pipe(
&mut self,
w: impl AsyncWrite + Write + Send + Sync + Unpin + 'static
)
pub fn stdout_pipe( &mut self, w: impl AsyncWrite + Write + Send + Sync + Unpin + 'static )
Sets the WASI stdout
descriptor to the given Write
er.
sourcepub fn stdout_buffered(&mut self) -> Result<OutputBuffer>
pub fn stdout_buffered(&mut self) -> Result<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 AsyncWrite + Write + Send + Sync + Unpin + 'static
)
pub fn stderr_pipe( &mut self, w: impl AsyncWrite + Write + Send + Sync + Unpin + 'static )
Sets the WASI stderr
descriptor to the given Write
er.
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 [Store::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§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> GetSetFdFlags for T
impl<T> GetSetFdFlags for T
source§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.source§fn new_set_fd_flags(&self, fd_flags: FdFlags) -> Result<SetFdFlags<T>, Error>where
T: AsFilelike,
fn new_set_fd_flags(&self, fd_flags: FdFlags) -> Result<SetFdFlags<T>, Error>where
T: AsFilelike,
source§fn set_fd_flags(&mut self, set_fd_flags: SetFdFlags<T>) -> Result<(), Error>where
T: AsFilelike,
fn set_fd_flags(&mut self, set_fd_flags: SetFdFlags<T>) -> Result<(), Error>where
T: AsFilelike,
self
file descriptor. Read more