pub enum TaskResult {
Pending,
Started,
Success(Value),
Failure(String),
Revoked,
Retry(u32),
}Expand description
Task result state
Variants§
Pending
Task is pending execution
Started
Task is currently running
Success(Value)
Task completed successfully
Failure(String)
Task failed with error
Revoked
Task was revoked/cancelled
Retry(u32)
Task retry scheduled
Implementations§
Source§impl TaskResult
impl TaskResult
Sourcepub fn is_pending(&self) -> bool
pub fn is_pending(&self) -> bool
Check if the task is pending
Sourcepub fn is_started(&self) -> bool
pub fn is_started(&self) -> bool
Check if the task is started
Sourcepub fn is_success(&self) -> bool
pub fn is_success(&self) -> bool
Check if the task succeeded
Sourcepub fn is_failure(&self) -> bool
pub fn is_failure(&self) -> bool
Check if the task failed
Sourcepub fn is_revoked(&self) -> bool
pub fn is_revoked(&self) -> bool
Check if the task was revoked
Sourcepub fn is_terminal(&self) -> bool
pub fn is_terminal(&self) -> bool
Check if the task is in a terminal state (success, failure, or revoked)
Sourcepub fn same_variant(&self, other: &TaskResult) -> bool
pub fn same_variant(&self, other: &TaskResult) -> bool
Check if two TaskResult values are of the same variant type
This compares only the variant, ignoring inner values.
For example, Success(1) and Success(2) are considered the same.
Sourcepub fn success_value(&self) -> Option<&Value>
pub fn success_value(&self) -> Option<&Value>
Get the success result value if the task succeeded
Sourcepub fn failure_message(&self) -> Option<&str>
pub fn failure_message(&self) -> Option<&str>
Get the failure error message if the task failed
Sourcepub fn retry_count(&self) -> Option<u32>
pub fn retry_count(&self) -> Option<u32>
Get the retry count if the task is being retried
Trait Implementations§
Source§impl Clone for TaskResult
impl Clone for TaskResult
Source§fn clone(&self) -> TaskResult
fn clone(&self) -> TaskResult
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for TaskResult
impl Debug for TaskResult
Source§impl<'de> Deserialize<'de> for TaskResult
impl<'de> Deserialize<'de> for TaskResult
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
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 Display for TaskResult
impl Display for TaskResult
Source§impl PartialEq for TaskResult
impl PartialEq for TaskResult
Source§impl Serialize for TaskResult
impl Serialize for TaskResult
impl Eq for TaskResult
impl StructuralPartialEq for TaskResult
Auto Trait Implementations§
impl Freeze for TaskResult
impl RefUnwindSafe for TaskResult
impl Send for TaskResult
impl Sync for TaskResult
impl Unpin for TaskResult
impl UnsafeUnpin for TaskResult
impl UnwindSafe for TaskResult
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more