pub trait JobHost: Send + Sync {
// Required methods
fn spawn(&self, req: JobSpawnRequest) -> JobId;
fn cancel(&self, job_id: &JobId) -> bool;
fn status(&self, job_id: &JobId) -> Option<JobStatus>;
fn drain_events(&self) -> Vec<JobEvent>;
}Expand description
Host-side trait for job orchestration.
The ProGit TUI implements this and injects it into the plugin runtime.
Plugins receive a Box<dyn JobHost> (or Lua equivalent) and call
spawn, cancel, and status — never std::process::Command directly.
Required Methods§
Sourcefn spawn(&self, req: JobSpawnRequest) -> JobId
fn spawn(&self, req: JobSpawnRequest) -> JobId
Spawn a background job. Returns the opaque JobId.
Sourcefn cancel(&self, job_id: &JobId) -> bool
fn cancel(&self, job_id: &JobId) -> bool
Cancel a job the plugin previously spawned. Returns true if cancellation was sent; false if job already finished.
Sourcefn drain_events(&self) -> Vec<JobEvent>
fn drain_events(&self) -> Vec<JobEvent>
Drain events for jobs owned by this plugin. Non-blocking: returns events accumulated since last call.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".