Struct HttpResponse
#[non_exhaustive]pub struct HttpResponse {
pub status: u16,
pub body: Bytes,
}Expand description
A complete HTTP response, already buffered.
Bytes rather than a reader because there is nothing to read from — the
endpoint answers once. A body over MAX_RESPONSE_BYTES never becomes one
of these.
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: u16The HTTP status code.
body: BytesThe whole body.
Implementations§
§impl HttpResponse
impl HttpResponse
pub const fn is_success(&self) -> bool
pub const fn is_success(&self) -> bool
Whether the status is in the 2xx range.
Trait Implementations§
§impl Clone for HttpResponse
impl Clone for HttpResponse
Auto Trait Implementations§
impl !Freeze for HttpResponse
impl RefUnwindSafe for HttpResponse
impl Send for HttpResponse
impl Sync for HttpResponse
impl Unpin for HttpResponse
impl UnsafeUnpin for HttpResponse
impl UnwindSafe for HttpResponse
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