Skip to main content

JobHost

Trait JobHost 

Source
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§

Source

fn spawn(&self, req: JobSpawnRequest) -> JobId

Spawn a background job. Returns the opaque JobId.

Source

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.

Source

fn status(&self, job_id: &JobId) -> Option<JobStatus>

Poll the current status of a job.

Source

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".

Implementors§