pub trait Worker<Req, Resp>: Send + Sync {
// Required methods
fn id(&self) -> WorkerId;
fn health(&self) -> WorkerHealth;
fn dispatch(&self, req: Req) -> Result<Resp, WorkerError>;
}Expand description
Trait every worker implements. Req and Resp are
caller-defined; the future subprocess flavour will use a
serde-friendly wire type as both parameters.
Required Methods§
fn id(&self) -> WorkerId
fn health(&self) -> WorkerHealth
Sourcefn dispatch(&self, req: Req) -> Result<Resp, WorkerError>
fn dispatch(&self, req: Req) -> Result<Resp, WorkerError>
Block until this request finishes. Errors propagate the engine’s failure mode without crashing the worker.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".