pub struct Engine { /* private fields */ }Expand description
Process-wide Wasmtime engine. Reuse it across runs.
A background thread ticks the engine epoch about once a millisecond.
Each run sets a one-tick deadline and decides, on that tick, whether to
keep going, time out, or die because its KillHandle was fired.
Implementations§
Source§impl Engine
impl Engine
pub fn new() -> Result<Self, Error>
Sourcepub fn kill_handle(&self) -> KillHandle
pub fn kill_handle(&self) -> KillHandle
A kill switch bound to this engine. Clone it into another thread.
Source§impl Engine
impl Engine
Sourcepub fn execute(&self, request: RunRequest) -> Result<Report, Error>
pub fn execute(&self, request: RunRequest) -> Result<Report, Error>
Run a module. Timeout still applies. Nothing is killed unless the process is torn down.
Sourcepub fn execute_with(
&self,
request: RunRequest,
kill: &KillHandle,
) -> Result<Report, Error>
pub fn execute_with( &self, request: RunRequest, kill: &KillHandle, ) -> Result<Report, Error>
Run a module. KillHandle::kill from another thread stops this run
and leaves other runs on this engine alone.
Sourcepub fn execute_with_preflight(
&self,
request: RunRequest,
kill: &KillHandle,
preflight: &dyn Preflight,
) -> Result<Report, Error>
pub fn execute_with_preflight( &self, request: RunRequest, kill: &KillHandle, preflight: &dyn Preflight, ) -> Result<Report, Error>
Like Self::execute_with, but asks preflight before instantiation.
Keywarden (or any policy) can deny the run without starting the guest.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Engine
impl !UnwindSafe for Engine
impl Forget for Engine
impl Freeze for Engine
impl Send for Engine
impl Sync for Engine
impl Unpin for Engine
impl UnsafeUnpin for Engine
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§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> ⓘ
Converts
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> ⓘ
Converts
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