pub struct Runtime<Model: BaseModel> { /* private fields */ }Expand description
Runtime wraps a model in a dedicated control thread. It manages lifecycle, control-plane inputs, cancellation, and OS termination signals.
Implementations§
Source§impl<Model: BaseModel> Runtime<Model>
impl<Model: BaseModel> Runtime<Model>
Sourcepub fn is_model_running(&self) -> bool
pub fn is_model_running(&self) -> bool
Returns true if the model is running.
Sourcepub fn control_tx(&mut self) -> &mut RingSender<Input<Model::Event>>
pub fn control_tx(&mut self) -> &mut RingSender<Input<Model::Event>>
Returns a mutable reference to the control-plane sender.
Sourcepub fn run_blocking(self) -> Result<()>
pub fn run_blocking(self) -> Result<()>
Blocks until the runtime thread finishes.
Sourcepub fn into_guard(self) -> RuntimeGuard<Model>
pub fn into_guard(self) -> RuntimeGuard<Model>
Wraps the runtime into a guard that auto-shuts down on drop.
Sourcepub fn spawn_blocking(
cfg: RuntimeConfig,
model_ctx: Model::Ctx,
model_cfg: Model::Config,
output_tx: Model::OutputTx,
) -> Result<()>
pub fn spawn_blocking( cfg: RuntimeConfig, model_ctx: Model::Ctx, model_cfg: Model::Config, output_tx: Model::OutputTx, ) -> Result<()>
Spawns the runtime and blocks until it ends.
Trait Implementations§
Auto Trait Implementations§
impl<Model> !Freeze for Runtime<Model>
impl<Model> !RefUnwindSafe for Runtime<Model>
impl<Model> Send for Runtime<Model>where
Model: Send,
impl<Model> !Sync for Runtime<Model>
impl<Model> Unpin for Runtime<Model>where
Model: Unpin,
impl<Model> !UnwindSafe for Runtime<Model>
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