#[non_exhaustive]pub enum TaskEvent<Res> {
Complete(TaskResult<Res>),
Lock {
task_id: TaskId,
},
Release {
task_id: TaskId,
},
Cancel {
task_id: TaskId,
},
}sleep only.Expand description
A message representing a state transition or event for a task within the task processing system.
Res is the task’s associated output/payload type, and Id is the
underlying identifier type used to uniquely reference a task.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Complete(TaskResult<Res>)
Signals that a task has finished processing, carrying its result.
This is sent once a worker has finished executing a task,
regardless of whether it succeeded or failed — the outcome itself
is encoded in TaskResult.
Lock
Requests that a lock has been acquired on the given task, preventing other workers from picking it up concurrently.
Release
Releases a previously acquired lock on the given task, making it available for other workers to claim.
This is typically sent after a task completes, fails, or its lock needs to be freed without marking the task as complete (e.g. on worker shutdown).
Cancel
Requests that the given task be cancelled.
This may be sent before a task has started, or while it is in progress, depending on what the consuming system supports.
Trait Implementations§
Source§impl<'de, Res> Deserialize<'de> for TaskEvent<Res>where
Res: Deserialize<'de>,
Available on crate feature serde only.
impl<'de, Res> Deserialize<'de> for TaskEvent<Res>where
Res: Deserialize<'de>,
serde only.