pub enum RetryOutcome<'a> {
Response(&'a Response),
Transport(&'a TransportError),
}Expand description
What one execution of a request produced, handed to RetryPolicy::retry so it can decide
whether to retry. It is either the raw Response the inner backend returned (any status —
success or error), or the TransportError it failed with (DNS, connect, timeout, …).
The policy inspects it to make its decision: RetryOutcome::status exposes the response status
(e.g. retry on 429/5xx), RetryOutcome::transport_error the transport failure (e.g. retry
on a timeout), and RetryOutcome::is_transient applies the runtime’s own transient-failure
classifier as a sensible default.
Variants§
Response(&'a Response)
The inner backend returned a response with this status; the body has not been read yet.
Transport(&'a TransportError)
The inner backend failed at the transport layer before producing a response.
Implementations§
Source§impl<'a> RetryOutcome<'a>
impl<'a> RetryOutcome<'a>
Sourcepub fn response(&self) -> Option<&Response>
pub fn response(&self) -> Option<&Response>
The response, if the attempt produced one (any status). None on a transport failure.
Sourcepub fn transport_error(&self) -> Option<&TransportError>
pub fn transport_error(&self) -> Option<&TransportError>
The transport failure, if the attempt failed before producing a response. None otherwise.
Sourcepub fn status(&self) -> Option<StatusCode>
pub fn status(&self) -> Option<StatusCode>
The response status, if any. None on a transport failure — a policy keying purely on
status can treat that as “retry” or “stop” as it sees fit.
Sourcepub fn result(&self) -> Result<&Response, &TransportError>
pub fn result(&self) -> Result<&Response, &TransportError>
The outcome as a Result, mirroring what the inner backend returned.
Sourcepub fn is_transient(&self) -> bool
pub fn is_transient(&self) -> bool
Whether the outcome is transient by the runtime’s default classifier — the same rule
super::Error::is_transient applies: any transport failure, plus a 429 or 5xx
response. Policies are free to ignore this and key on Self::status /
Self::transport_error directly.