pub struct WasmtimeEngineProviderBuilder<'a> { /* private fields */ }
Expand description
Used to build WasmtimeEngineProvider
instances.
Implementations§
source§impl<'a> WasmtimeEngineProviderBuilder<'a>
impl<'a> WasmtimeEngineProviderBuilder<'a>
sourcepub fn module_bytes(self, module_bytes: &'a [u8]) -> Self
pub fn module_bytes(self, module_bytes: &'a [u8]) -> Self
Provide contents of the WebAssembly module
sourcepub fn module(self, module: Module) -> Self
pub fn module(self, module: Module) -> Self
Provide a preloaded wasmtime::Module
Warning: the wasmtime::Engine
used to load it must be provided via the
WasmtimeEngineProviderBuilder::engine
method, otherwise the code
will panic at runtime later.
sourcepub fn engine(self, engine: Engine) -> Self
pub fn engine(self, engine: Engine) -> Self
Provide a preinitialized wasmtime::Engine
Warning: when used, engine specific options like
cache
and
enable_epoch_interruptions
must be pre-configured by the user. WasmtimeEngineProviderBuilder
won’t be
able to configure them at build
time.
sourcepub fn wasi_params(self, wasi: WasiParams) -> Self
pub fn wasi_params(self, wasi: WasiParams) -> Self
WASI params
sourcepub fn enable_epoch_interruptions(
self,
wapc_init_deadline: u64,
wapc_func_deadline: u64
) -> Self
pub fn enable_epoch_interruptions( self, wapc_init_deadline: u64, wapc_func_deadline: u64 ) -> Self
Enable Wasmtime epoch-based interruptions and set the deadlines to be enforced
Two kind of deadlines have to be set:
wapc_init_deadline
: the number of ticks the waPC initialization code can take before the code is interrupted. This is the code usually defined inside of thewapc_init
/_start
functionswapc_func_deadline
: the number of ticks any regular waPC guest function can run before its terminated by the host
Both these limits are expressed using the number of ticks that are allowed before the WebAssembly execution is interrupted. It’s up to the embedder of waPC to define how much time a single tick is granted. This could be 1 second, 10 nanoseconds, or whatever the user prefers.
Warning: when providing an instance of wasmtime::Engine
via the
WasmtimeEngineProvider::engine
helper, ensure the wasmtime::Engine
has been created with the epoch_interruption
feature enabled
sourcepub fn build_pre(&self) -> Result<WasmtimeEngineProviderPre, Error>
pub fn build_pre(&self) -> Result<WasmtimeEngineProviderPre, Error>
Create a WasmtimeEngineProviderPre
instance. This instance can then
be reused as many time as wanted to quickly instantiate a WasmtimeEngineProvider
by using the WasmtimeEngineProviderPre::rehydrate
method.
sourcepub fn build(&self) -> Result<WasmtimeEngineProvider, Error>
pub fn build(&self) -> Result<WasmtimeEngineProvider, Error>
Create a WasmtimeEngineProvider
instance
Trait Implementations§
source§impl<'a> Default for WasmtimeEngineProviderBuilder<'a>
impl<'a> Default for WasmtimeEngineProviderBuilder<'a>
source§fn default() -> WasmtimeEngineProviderBuilder<'a>
fn default() -> WasmtimeEngineProviderBuilder<'a>
Auto Trait Implementations§
impl<'a> Freeze for WasmtimeEngineProviderBuilder<'a>
impl<'a> !RefUnwindSafe for WasmtimeEngineProviderBuilder<'a>
impl<'a> Send for WasmtimeEngineProviderBuilder<'a>
impl<'a> Sync for WasmtimeEngineProviderBuilder<'a>
impl<'a> Unpin for WasmtimeEngineProviderBuilder<'a>
impl<'a> !UnwindSafe for WasmtimeEngineProviderBuilder<'a>
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