pub struct ErrorResponse { /* private fields */ }Expand description
The headers and the capped body of an unsuccessful response to a fetch.
Error::HttpStatus carries it if the request set
max_error_body. A caller outside this
crate builds one with new.
The Debug output shows the name of each header, and <redacted> in
place of its value. A header with several values shows its name once for
each value. The body shows as its length.
Implementations§
Source§impl ErrorResponse
impl ErrorResponse
Sourcepub fn new(headers: HeaderMap, body: Option<Vec<u8>>) -> ErrorResponse
pub fn new(headers: HeaderMap, body: Option<Vec<u8>>) -> ErrorResponse
Creates a response of headers and body.
Sourcepub fn body(&self) -> Option<&[u8]>
pub fn body(&self) -> Option<&[u8]>
Returns the whole body of the response.
The body is None in these cases:
- the response declared a
Content-Lengthover the cap - the body grew past the cap while it arrived
- the response declared a coding in
Content-EncodingorTransfer-Encoding - the body failed in transit
- the body did not arrive in full within one
progress_timeoutfrom the arrival of the response head.
The fetcher never keeps a part of a body.
Trait Implementations§
Auto Trait Implementations§
impl Forget for ErrorResponse
impl Freeze for ErrorResponsewhere
*const [Pos] is !null: Freeze,
PhantomData<[Pos]>: Freeze,
*const u8 is !null: Freeze,
PhantomData<Bucket<HeaderValue>>: Freeze,
*const Cold<HeaderValue> is !null: Freeze,
PhantomData<Cold<HeaderValue>>: Freeze,
PhantomData<u8>: Freeze,
impl Move for ErrorResponse
impl RefUnwindSafe for ErrorResponse
impl Send for ErrorResponse
impl Sync for ErrorResponse
impl Unpin for ErrorResponse
impl UnsafeUnpin for ErrorResponsewhere
*const [Pos] is !null: UnsafeUnpin,
PhantomData<[Pos]>: UnsafeUnpin,
*const u8 is !null: UnsafeUnpin,
PhantomData<Bucket<HeaderValue>>: UnsafeUnpin,
*const Cold<HeaderValue> is !null: UnsafeUnpin,
PhantomData<Cold<HeaderValue>>: UnsafeUnpin,
PhantomData<u8>: UnsafeUnpin,
impl UnwindSafe for ErrorResponsewhere
BoxRaw<[Pos]>: UnwindSafe,
RawVecInner: UnwindSafe,
*const u8: UnwindSafe,
Align8<*mut ()>: UnwindSafe,
&'static Vtable: UnwindSafe,
BoxRaw<Cold<HeaderValue>>: UnwindSafe,
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