pub enum WorkerResult {
Success {
result: Option<String>,
duration_ms: u64,
metadata: HashMap<String, String>,
},
Retry {
error: String,
stack_trace: Option<String>,
retry_at: Option<DateTime<Utc>>,
context: HashMap<String, String>,
},
Failure {
error: String,
stack_trace: Option<String>,
context: HashMap<String, String>,
},
}
Expand description
Result of job execution
Variants§
Success
Job completed successfully
Fields
Retry
Job failed and should be retried
Fields
Failure
Job failed permanently (no retry)
Implementations§
Source§impl WorkerResult
impl WorkerResult
Sourcepub fn success_with_metadata(
result: Option<String>,
duration_ms: u64,
metadata: HashMap<String, String>,
) -> Self
pub fn success_with_metadata( result: Option<String>, duration_ms: u64, metadata: HashMap<String, String>, ) -> Self
Create a successful result with metadata
Sourcepub fn retry_with_context(
error: String,
retry_at: Option<DateTime<Utc>>,
context: HashMap<String, String>,
) -> Self
pub fn retry_with_context( error: String, retry_at: Option<DateTime<Utc>>, context: HashMap<String, String>, ) -> Self
Create a retry result with context
Sourcepub fn failure_with_context(
error: String,
context: HashMap<String, String>,
) -> Self
pub fn failure_with_context( error: String, context: HashMap<String, String>, ) -> Self
Create a permanent failure result with context
Sourcepub fn is_success(&self) -> bool
pub fn is_success(&self) -> bool
Check if the result indicates success
Sourcepub fn should_retry(&self) -> bool
pub fn should_retry(&self) -> bool
Check if the result indicates a retry should be attempted
Sourcepub fn is_failure(&self) -> bool
pub fn is_failure(&self) -> bool
Check if the result indicates permanent failure
Sourcepub fn error_message(&self) -> Option<&str>
pub fn error_message(&self) -> Option<&str>
Get the error message if this is an error result
Trait Implementations§
Source§impl Clone for WorkerResult
impl Clone for WorkerResult
Source§fn clone(&self) -> WorkerResult
fn clone(&self) -> WorkerResult
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 WorkerResult
impl Debug for WorkerResult
Source§impl<'de> Deserialize<'de> for WorkerResult
impl<'de> Deserialize<'de> for WorkerResult
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
Auto Trait Implementations§
impl Freeze for WorkerResult
impl RefUnwindSafe for WorkerResult
impl Send for WorkerResult
impl Sync for WorkerResult
impl Unpin for WorkerResult
impl UnwindSafe for WorkerResult
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