#[non_exhaustive]pub struct ApiFailure {
pub status: u16,
pub reason: Option<String>,
pub detail: Option<String>,
pub retry_after_ms: Option<u64>,
}Expand description
A failed key route: the HTTP status and details.reason, or a transport failure
(status = 0). The driver retries transport failures and 503 voice_unavailable itself
(with backoff, unchanged content); what reaches the session is final.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.status: u16HTTP status (0 = transport).
reason: Option<String>details.reason, when the envelope has one.
detail: Option<String>details.check / details.unsupported, when present.
retry_after_ms: Option<u64>retry_after_ms / Retry-After, when present.
Implementations§
Source§impl ApiFailure
impl ApiFailure
Sourcepub fn new(status: u16, reason: &str) -> ApiFailure
pub fn new(status: u16, reason: &str) -> ApiFailure
A failure with a status and reason.
Sourcepub fn transport() -> ApiFailure
pub fn transport() -> ApiFailure
A transport failure.
Sourcepub fn from_status(status: u16) -> ApiFailure
pub fn from_status(status: u16) -> ApiFailure
A failure with a status only: no reason, detail or retry_after_ms (set them with
the with_* setters).
Sourcepub fn with_reason(self, reason: Option<String>) -> ApiFailure
pub fn with_reason(self, reason: Option<String>) -> ApiFailure
Sets reason (details.reason).
Sourcepub fn with_detail(self, detail: Option<String>) -> ApiFailure
pub fn with_detail(self, detail: Option<String>) -> ApiFailure
Sets detail (details.check / details.unsupported).
Sourcepub fn with_retry_after_ms(self, retry_after_ms: Option<u64>) -> ApiFailure
pub fn with_retry_after_ms(self, retry_after_ms: Option<u64>) -> ApiFailure
Sets retry_after_ms.
Sourcepub fn is_retryable(&self) -> bool
pub fn is_retryable(&self) -> bool
A failure the driver retries (transport, 503).
Trait Implementations§
Source§impl Clone for ApiFailure
impl Clone for ApiFailure
Source§impl Debug for ApiFailure
impl Debug for ApiFailure
impl Eq for ApiFailure
Source§impl PartialEq for ApiFailure
impl PartialEq for ApiFailure
impl StructuralPartialEq for ApiFailure
Auto Trait Implementations§
impl Forget for ApiFailure
impl Freeze for ApiFailure
impl Move for ApiFailure
impl RefUnwindSafe for ApiFailure
impl Send for ApiFailure
impl Sync for ApiFailure
impl Unpin for ApiFailure
impl UnsafeUnpin for ApiFailure
impl UnwindSafe for ApiFailure
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
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> ⓘ
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