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
Available on crate feature wasi only.
pub fn wasi_params(self, wasi: WasiParams) -> Self
wasi only.WASI params
Sourcepub fn enable_cache(self, path: Option<&Path>) -> Self
Available on crate feature cache only.
pub fn enable_cache(self, path: Option<&Path>) -> Self
cache only.Enable Wasmtime cache feature
Warning: this has no effect when a custom wasmtime::Engine is provided via
the WasmtimeEngineProviderBuilder::engine helper. In that case, it’s up to the
user to provide a wasmtime::Engine instance with the cache values properly configured.
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/_startfunctionswapc_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
Sourcepub fn build_async_pre(&self) -> Result<WasmtimeEngineProviderAsyncPre, Error>
Available on crate feature async only.
pub fn build_async_pre(&self) -> Result<WasmtimeEngineProviderAsyncPre, Error>
async only.Create a WasmtimeEngineProviderAsyncPre instance. This instance can then
be reused as many time as wanted to quickly instantiate a WasmtimeEngineProviderAsync
by using the WasmtimeEngineProviderAsyncPre::rehydrate method.
Warning: if provided by the user, the wasmtime::Engine must have been
created with async support enabled otherwise the code will panic at runtime.
Sourcepub fn build_async(&self) -> Result<WasmtimeEngineProviderAsync, Error>
Available on crate feature async only.
pub fn build_async(&self) -> Result<WasmtimeEngineProviderAsync, Error>
async only.Create a WasmtimeEngineProviderAsync 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 moreSource§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more