pub enum HandlerOutput {
Success {
output: Option<Vec<u8>>,
consumption: Vec<BudgetConsumption>,
},
RetryableFailure {
error: String,
consumption: Vec<BudgetConsumption>,
},
TerminalFailure {
error: String,
consumption: Vec<BudgetConsumption>,
},
Suspended {
output: Option<Vec<u8>>,
consumption: Vec<BudgetConsumption>,
},
}Expand description
Outcome of an attempt execution.
The handler return type uses typed variants to distinguish between
successful completion, retryable failures (transient errors that may
succeed on retry), and terminal failures (permanent errors that should
not be retried). Handlers may also return Suspended to signal that
execution was voluntarily preempted (e.g. in response to budget exhaustion).
All variants carry a consumption list: zero or more BudgetConsumption
records reporting the resources consumed during this attempt. The dispatch
loop durably records these after each attempt completes.
Variants§
Success
Execution completed successfully.
Fields
consumption: Vec<BudgetConsumption>Resource consumption incurred during this attempt.
RetryableFailure
Execution failed but may succeed on retry (transient failure).
Fields
consumption: Vec<BudgetConsumption>Resource consumption incurred before the failure.
TerminalFailure
Execution failed permanently and should not be retried.
Fields
consumption: Vec<BudgetConsumption>Resource consumption incurred before the failure.
Suspended
Execution was voluntarily suspended (e.g. budget exhaustion signalled via
the cancellation token). The run transitions to Suspended and does not
count this attempt toward the max_attempts retry cap.
Implementations§
Source§impl HandlerOutput
impl HandlerOutput
Sourcepub fn success_with_output(output: Vec<u8>) -> Self
pub fn success_with_output(output: Vec<u8>) -> Self
Creates a success output with output bytes and no consumption.
Sourcepub fn retryable_failure(error: impl Into<String>) -> Self
pub fn retryable_failure(error: impl Into<String>) -> Self
Creates a retryable failure with no consumption.
Sourcepub fn terminal_failure(error: impl Into<String>) -> Self
pub fn terminal_failure(error: impl Into<String>) -> Self
Creates a terminal failure with no consumption.
Sourcepub fn suspended() -> Self
pub fn suspended() -> Self
Creates a suspended outcome with no partial state and no consumption.
Sourcepub fn suspended_with_output(
output: Vec<u8>,
consumption: Vec<BudgetConsumption>,
) -> Self
pub fn suspended_with_output( output: Vec<u8>, consumption: Vec<BudgetConsumption>, ) -> Self
Creates a suspended outcome with partial-state bytes and consumption.
Sourcepub fn consumption(&self) -> &[BudgetConsumption]
pub fn consumption(&self) -> &[BudgetConsumption]
Returns the resource consumption reported by this handler output.
Trait Implementations§
Source§impl Clone for HandlerOutput
impl Clone for HandlerOutput
Source§fn clone(&self) -> HandlerOutput
fn clone(&self) -> HandlerOutput
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more