pub struct Refusal {
pub status: u16,
pub code: Option<String>,
pub retry: Option<Retry>,
pub message: String,
pub details: Map<String, Value>,
}Expand description
A non-2xx answer to an upload, preflight, or mirror request.
Fields§
§status: u16§code: Option<String>The server’s stable identifier for this refusal, when it sent one.
None means a server without the vocabulary, to be read by status.
retry: Option<Retry>§message: StringFor a person: the body’s message, else X-Reason, else the raw body.
details: Map<String, Value>The numbers behind the message: limit, used, retry_after, mime.
Implementations§
Source§impl Refusal
impl Refusal
Sourcepub fn from_response(status: u16, headers: &HeaderMap, body: &str) -> Self
pub fn from_response(status: u16, headers: &HeaderMap, body: &str) -> Self
Read a refusal out of a response. body may be empty (a HEAD has
none), in which case the headers carry everything Magnitude sends.
pub fn code(&self) -> Option<&str>
pub fn retry_after(&self) -> Option<Duration>
Sourcepub fn is_size_limit(&self) -> bool
pub fn is_size_limit(&self) -> bool
The file is bigger than this server takes — a property of the file’s size, so worth remembering. A quota refusal is deliberately NOT this: it shares the 413 but says nothing about size.
Sourcepub fn worth_retrying_here(&self) -> bool
pub fn worth_retrying_here(&self) -> bool
Whether sending the same request to the same server again, right now, has any chance. A coded server is believed; an uncoded one is retried unless the status is one that never changes on a retry.
Trait Implementations§
impl Eq for Refusal
impl StructuralPartialEq for Refusal
Auto Trait Implementations§
impl Freeze for Refusal
impl RefUnwindSafe for Refusal
impl Send for Refusal
impl Sync for Refusal
impl Unpin for Refusal
impl UnsafeUnpin for Refusal
impl UnwindSafe for Refusal
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
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§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
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> ⓘ
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