origin-jobs
Background jobs for Origin: progress, cancellation and a uniform lifecycle.
Part of Origin, a Rust/Tauri platform for building desktop applications from a shared set of domain crates. See the workspace documentation for how the pieces fit together, and ARCHITECTURE.md for the rules this crate follows.
Example
use Clock;
use EventBus;
use Jobs;
use Arc;
let jobs = new;
let id = jobs.spawn;
let status = jobs.get.await;
jobs.cancel.await?;
Two things plain spawn cannot do, for a request/response handler that needs the
job's result directly rather than polling Jobs::get:
// Refuses to start if a "crawl" job is already running, and gives the caller a
// typed result to await — the common shape for "run this, only one at a time, and
// hand me back what it computed".
let = jobs.spawn_exclusive_awaitable?;
let report = result.wait.await?;
spawn_exclusive and spawn_awaitable are the same two capabilities on their own,
for when only one of them applies.
Stability
Pre-1.0 (0.2.0). Public types, enums and field sets may still change between minor
versions; pin an exact version if that matters to you.