pub struct HttpResponse { /* private fields */ }Implementations§
Source§impl HttpResponse
impl HttpResponse
Sourcepub fn builder() -> HttpResponseBuilder<SetStatus>
pub fn builder() -> HttpResponseBuilder<SetStatus>
Create a new response using builder.
Sourcepub fn from_parts(body: BoxBody<Bytes, Error>, parts: Parts) -> HttpResponse
pub fn from_parts(body: BoxBody<Bytes, Error>, parts: Parts) -> HttpResponse
Create a new response from hyper parts.
Sourcepub fn body(self) -> BoxBody<Bytes, Error>
pub fn body(self) -> BoxBody<Bytes, Error>
Returns the boxed body.
Used for moving body between requests/responses.
This consumes the HttpResponse
Sourcepub fn body_as_stream(self) -> BodyDataStream<BoxBody<Bytes, Error>>
pub fn body_as_stream(self) -> BodyDataStream<BoxBody<Bytes, Error>>
Returns the body data stream.
This consumes the HttpRequest
Sourcepub async fn body_as_bytes(self) -> Result<Bytes>
pub async fn body_as_bytes(self) -> Result<Bytes>
Returns the body as bytes.
This consumes the HttpResponse
Sourcepub fn headers(&self) -> &HeaderMap<HeaderValue>
pub fn headers(&self) -> &HeaderMap<HeaderValue>
Returns all headers.
Trait Implementations§
Source§impl Debug for HttpResponse
impl Debug for HttpResponse
Source§impl From<HttpResponse> for Response<BoxBody<Bytes, Error>>
impl From<HttpResponse> for Response<BoxBody<Bytes, Error>>
Source§fn from(res: HttpResponse) -> Self
fn from(res: HttpResponse) -> Self
Converts to this type from the input type.
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