pub struct Terminal { /* private fields */ }Expand description
Immutable terminal fact shared by every waiter.
outcome is four words wide, so on its own it does not
say much: if it is Outcome::Failed, the reason is one call away.
failure_kind is the matchable classification and
failure is the error itself, whose
source chain reaches the concrete provider or hook error
underneath.
if terminal.outcome() == lifecycle::Outcome::Failed {
// Never report `Failed` on its own: these two say what happened.
format!(
"failed ({:?}): {}",
terminal.failure_kind(),
terminal.failure().map_or_else(|| "no detail".to_owned(), ToString::to_string),
)
} else {
format!("{:?}", terminal.outcome())
}Implementations§
Source§impl Terminal
impl Terminal
Sourcepub const fn stop_code(&self) -> Option<&StopCode>
pub const fn stop_code(&self) -> Option<&StopCode>
Returns an explicit hook stop code when one ended the Run.
Sourcepub fn failure(&self) -> Option<&(dyn Error + Send + Sync + 'static)>
pub fn failure(&self) -> Option<&(dyn Error + Send + Sync + 'static)>
Returns execution failure detail for a failed Run.
Some exactly when outcome is
Failed. Its Display is already the
complete rendered reason, stage and payload together — reef renders each
failure where it is latched, because the crate-private stage error cannot
outlive the Run and a classification alone does not diagnose anything.
source is therefore for inspecting the failure rather
than for re-rendering it: it reaches an underlying model-client, hook,
transcript, or other error that caused the Run to fail. A nonfatal
tool::ProviderError does not appear here;
obtain it from the outward event’s
as_error accessor. A chain walk that
concatenates every link will see the tail of the first message repeated,
which is why this is worth stating.
Sourcepub const fn failure_kind(&self) -> Option<FailureKind>
pub const fn failure_kind(&self) -> Option<FailureKind>
Returns the portable classification of a failed Run.
Trait Implementations§
Source§impl Debug for Terminal
impl Debug for Terminal
Source§fn fmt(&self, formatter: &mut Formatter<'_>) -> Result
fn fmt(&self, formatter: &mut Formatter<'_>) -> Result
States how the Run ended, rendering the failure through Display.
The failure is an arbitrary third-party error whose Debug this crate
neither writes nor reviews; Display is the operator diagnostic the type
is contracted to produce, so that is what a terminal reports.