pub struct AttemptOutcome { /* private fields */ }Expand description
Semantic grouping of attempt result kind, optional error detail, and optional opaque handler output.
The result and error fields are semantically coupled: the error message
is only meaningful in the context of its result kind. The output field is
an opaque byte payload that successful handlers can use to return structured
data to the dispatch loop / projection (e.g., ContextStore references).
Implementations§
Source§impl AttemptOutcome
impl AttemptOutcome
Sourcepub fn success_with_output(output: Vec<u8>) -> Self
pub fn success_with_output(output: Vec<u8>) -> Self
Creates a successful outcome carrying opaque output bytes.
An empty vec is normalized to None (no output).
Sourcepub fn failure(error: impl Into<String>) -> Self
pub fn failure(error: impl Into<String>) -> Self
Creates a failure outcome with an error message.
Sourcepub fn timeout(error: impl Into<String>) -> Self
pub fn timeout(error: impl Into<String>) -> Self
Creates a timeout outcome with an error message.
Sourcepub fn suspended() -> Self
pub fn suspended() -> Self
Creates a suspended outcome with no output.
Suspended attempts do not count toward the max_attempts retry cap.
Sourcepub fn suspended_with_output(output: Vec<u8>) -> Self
pub fn suspended_with_output(output: Vec<u8>) -> Self
Creates a suspended outcome carrying opaque partial-state bytes.
An empty vec is normalized to None (no output). The handler may use
this to persist partial execution state for use when the run resumes.
Sourcepub fn from_raw_parts(
result: AttemptResultKind,
error: Option<String>,
output: Option<Vec<u8>>,
) -> Result<Self, AttemptOutcomeError>
pub fn from_raw_parts( result: AttemptResultKind, error: Option<String>, output: Option<Vec<u8>>, ) -> Result<Self, AttemptOutcomeError>
Reconstructs an outcome from raw parts with semantic validation.
This is intended for WAL replay / deserialization paths where the result kind, error, and output are stored separately. Validates that:
Success/Suspendedhaveerror == None(output is optional)Failure/Timeouthaveerror == Some(_)andoutput == None
§Errors
Returns AttemptOutcomeError if the result kind and error do not
satisfy the semantic coupling invariant.
Sourcepub fn result(&self) -> AttemptResultKind
pub fn result(&self) -> AttemptResultKind
Returns the canonical attempt result kind.
Sourcepub fn output(&self) -> Option<&[u8]>
pub fn output(&self) -> Option<&[u8]>
Returns the optional opaque output bytes produced by the handler.
Sourcepub fn into_parts(self) -> (AttemptResultKind, Option<String>, Option<Vec<u8>>)
pub fn into_parts(self) -> (AttemptResultKind, Option<String>, Option<Vec<u8>>)
Consumes the outcome, returning its parts for ownership transfer.
Trait Implementations§
Source§impl Clone for AttemptOutcome
impl Clone for AttemptOutcome
Source§fn clone(&self) -> AttemptOutcome
fn clone(&self) -> AttemptOutcome
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more