pub struct TensorWasmEngine { /* private fields */ }Expand description
A configured wasmtime::Engine plus the background epoch ticker that
drives interruption.
Implementations§
Source§impl TensorWasmEngine
impl TensorWasmEngine
Sourcepub const EPOCH_TICK: Duration = DEFAULT_EPOCH_TICK
pub const EPOCH_TICK: Duration = DEFAULT_EPOCH_TICK
Default epoch tick interval.
Sourcepub fn with_config(cfg: EngineConfig) -> Result<Self, Error>
pub fn with_config(cfg: EngineConfig) -> Result<Self, Error>
Construct an engine with explicit configuration.
Sourcepub fn inner(&self) -> &Engine
pub fn inner(&self) -> &Engine
Borrow the underlying wasmtime Engine. Cheap (it’s Arc-shaped internally).
Sourcepub fn config(&self) -> &EngineConfig
pub fn config(&self) -> &EngineConfig
Borrow the engine config used at construction.
Sourcepub fn spawn_epoch_ticker(&mut self)
pub fn spawn_epoch_ticker(&mut self)
Spawn a background Tokio task that periodically increments the engine epoch counter. Must be called from inside a Tokio runtime.
Idempotent: if a ticker is already running this is a no-op.
Sourcepub fn stop_epoch_ticker(&mut self)
pub fn stop_epoch_ticker(&mut self)
Stop the epoch ticker if one is running.
Sourcepub fn is_epoch_ticker_running(&self) -> bool
pub fn is_epoch_ticker_running(&self) -> bool
True if spawn_epoch_ticker has been called
on this engine and the ticker has not been
stop_epoch_ticker’d.
Used by TensorWasmExecutor to
emit a one-shot operator warning the first time an instance is spawned
on an engine whose ticker is not running (deadlines are otherwise
silently inert).
Trait Implementations§
Source§impl Default for TensorWasmEngine
impl Default for TensorWasmEngine
Source§impl Drop for TensorWasmEngine
impl Drop for TensorWasmEngine
Auto Trait Implementations§
impl !RefUnwindSafe for TensorWasmEngine
impl !UnwindSafe for TensorWasmEngine
impl Freeze for TensorWasmEngine
impl Send for TensorWasmEngine
impl Sync for TensorWasmEngine
impl Unpin for TensorWasmEngine
impl UnsafeUnpin for TensorWasmEngine
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> 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