Skip to main content

RunControl

Trait RunControl 

Source
pub trait RunControl: Send + Sync {
    // Required methods
    fn cancel(&self) -> Result<(), Error>;
    fn was_cancelled(&self) -> bool;

    // Provided method
    fn pid(&self) -> Option<u32> { ... }
}
Expand description

Object-safe handle to an in-flight run. A process-backed harness cancels by signalling its child; a request-backed harness (a hosted LLM API) cancels by aborting its HTTP stream. The consumer only needs these two operations, so the concrete mechanism stays behind the trait.

Required Methods§

Source

fn cancel(&self) -> Result<(), Error>

Stop the run. Best-effort; idempotent.

Source

fn was_cancelled(&self) -> bool

Whether cancel was called.

Provided Methods§

Source

fn pid(&self) -> Option<u32>

The OS process id of the underlying child while it’s alive, for a process-backed run. None for adapters with no child process (a direct-model run aborts an HTTP stream, not a process) — so an embedder can record live pids and reap a child a hard crash orphaned.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§