pub struct RunOutcome {
pub run_id: RunId,
pub status: RunStatus,
pub consumed: Consumed,
pub chain_head: Digest,
pub output: Option<Tainted<Value>>,
}Expand description
What a run produced.
Fields§
§run_id: RunId§status: RunStatus§consumed: ConsumedWhat this run consumed — steps, effects, spend, elapsed, refusals.
Reported rather than left in the ledger because “what did the settlement
run cost” has to be answerable per item, and a batch sums its items. A
figure that only exists inside a dropped Ledger is a figure nobody can
bill against.
The whole tally rather than only the money: the counts are what a
ceiling is sized against, and an operator raising max_effects after a
run stopped short is asking exactly the question this answers.
chain_head: DigestTerminal hash of the run’s chain — what a signature would cover.
output: Option<Tainted<Value>>What the run produced, with its label.
Labelled rather than bare, and the difference is not cosmetic: a caller acting on a run’s answer needs to know whether a model, a peer or a person wrote it. The label was stripped here until an A2A reply projection read a marker key out of an untrusted answer and let a remote peer choose the envelope its own reply arrived in — a confused-deputy reachable because the one fact that would have refused it had been dropped at the boundary.
Implementations§
Source§impl RunOutcome
impl RunOutcome
Sourcepub const fn spend(&self) -> Spend
pub const fn spend(&self) -> Spend
What this run spent, in metered units — the money half of
consumed.
Sourcepub fn reason(&self) -> Option<Cow<'_, str>>
pub fn reason(&self) -> Option<Cow<'_, str>>
Why this run ended — RunStatus::reason without the match.
None for a success. The accessor is here as well as on the status
because this is the type an embedder holds after run(..), and a
summary field that silently stays empty is the shape this exists to
prevent.
Sourcepub fn success(self) -> Result<Tainted<Value>, RunFailure>
pub fn success(self) -> Result<Tainted<Value>, RunFailure>
The output if the run succeeded, or a RunFailure saying why not.
Every caller that acts on a run’s answer asks the same two questions —
did it work, and what did it say — and pattern-matching
status to learn the first is how the second gets read
off a run that quarantined. This folds the pair into one ?:
let answer = runtime.run("greet", input).await?.success()?;status stays public for the callers whose branches genuinely differ —
a suspended run is not a failed one, and an operator surface treats
them differently. This is for the caller to whom anything short of an
answer is an error.
§Errors
RunFailure for every non-succeeded status, carrying the run id and
the status itself.
Trait Implementations§
Source§impl Clone for RunOutcome
impl Clone for RunOutcome
Auto Trait Implementations§
impl Freeze for RunOutcome
impl RefUnwindSafe for RunOutcome
impl Send for RunOutcome
impl Sync for RunOutcome
impl Unpin for RunOutcome
impl UnsafeUnpin for RunOutcome
impl UnwindSafe for RunOutcome
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more