pub struct Failure {
pub kind: Kind,
pub code: Option<String>,
pub detail: String,
pub retry_after: Option<Duration>,
}Expand description
A failed completion.
Fields§
§kind: KindWhat it means.
code: Option<String>The endpoint’s own machine-readable code, if it gave one.
detail: StringA short explanation safe to show a person.
retry_after: Option<Duration>How long the endpoint asked to be left alone.
Implementations§
Source§impl Failure
impl Failure
Sourcepub fn model_error(&self) -> ModelError
pub fn model_error(&self) -> ModelError
Convert only typed classifications, never provider-controlled prose.
Sourcepub const fn retryable(&self) -> bool
pub const fn retryable(&self) -> bool
Whether asking again with the same idempotency key may succeed.
Sourcepub fn refused_unprocessed(&self, status: u16) -> bool
pub fn refused_unprocessed(&self, status: u16) -> bool
Whether HTTP refusal proves no inference was admitted: the provider
was rate-limited (429), overloaded (529) or unavailable for now (503,
which HTTP defines as a request not handled and names Retry-After
for). Billing failures never authorize replay, regardless of their
HTTP status, and neither does a provider that says it is switched off.
Trait Implementations§
impl Eq for Failure
impl StructuralPartialEq for Failure
Auto Trait Implementations§
impl Forget for Failure
impl Freeze for Failure
impl Move for Failure
impl RefUnwindSafe for Failure
impl Send for Failure
impl Sync for Failure
impl Unpin for Failure
impl UnsafeUnpin for Failure
impl UnwindSafe for Failure
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.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> ⓘ
Converts
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> ⓘ
Converts
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