Skip to main content

TaskEvent

Enum TaskEvent 

Source
#[non_exhaustive]
pub enum TaskEvent<Res> { Complete(TaskResult<Res>), Lock { task_id: TaskId, }, Release { task_id: TaskId, }, Cancel { task_id: TaskId, }, }
Available on crate feature 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
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

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.

Fields

§task_id: TaskId

The identifier of the task being locked.

§

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

Fields

§task_id: TaskId

The identifier of the task whose lock is being released.

§

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.

Fields

§task_id: TaskId

The identifier of the task being cancelled.

Trait Implementations§

Source§

impl<Res: Clone> Clone for TaskEvent<Res>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<Res: Debug> Debug for TaskEvent<Res>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de, Res> Deserialize<'de> for TaskEvent<Res>
where Res: Deserialize<'de>,

Available on crate feature serde only.
Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl<Res> Serialize for TaskEvent<Res>
where Res: Serialize,

Available on crate feature serde only.
Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

§

impl<Res> Freeze for TaskEvent<Res>
where TaskResult<Res>: Freeze,

§

impl<Res> RefUnwindSafe for TaskEvent<Res>

§

impl<Res> Send for TaskEvent<Res>
where TaskResult<Res>: Send,

§

impl<Res> Sync for TaskEvent<Res>
where TaskResult<Res>: Sync,

§

impl<Res> Unpin for TaskEvent<Res>
where TaskResult<Res>: Unpin,

§

impl<Res> UnsafeUnpin for TaskEvent<Res>
where TaskResult<Res>: UnsafeUnpin,

§

impl<Res> UnwindSafe for TaskEvent<Res>
where TaskResult<Res>: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more