Struct async_web_server::HttpResponse
source · pub struct HttpResponse<IO: AsyncRead + AsyncWrite + Unpin> { /* private fields */ }
Implementations§
source§impl<IO: AsyncRead + AsyncWrite + Unpin> HttpResponse<IO>
impl<IO: AsyncRead + AsyncWrite + Unpin> HttpResponse<IO>
sourcepub fn request_headers(&self) -> &HeaderMap
pub fn request_headers(&self) -> &HeaderMap
Access the original requests headers as http::HeaderMap.
sourcepub fn method(&self) -> Method
pub fn method(&self) -> Method
Return the original requests method as http::Method.
sourcepub fn version(&self) -> Version
pub fn version(&self) -> Version
Return the HTTP version as http::Version.
sourcepub fn headers(&self) -> &HeaderMap
pub fn headers(&self) -> &HeaderMap
Access the currently set response headers as http::HeaderMap.
sourcepub fn headers_mut(&mut self) -> &mut HeaderMap
pub fn headers_mut(&mut self) -> &mut HeaderMap
Access the currently set response headers as mutable http::HeaderMap.
sourcepub fn insert_header(
&mut self,
key: impl IntoHeaderName,
value: HeaderValue
) -> &mut Self
pub fn insert_header( &mut self, key: impl IntoHeaderName, value: HeaderValue ) -> &mut Self
Insert a response header (chainable).
sourcepub fn status(&self) -> StatusCode
pub fn status(&self) -> StatusCode
Access the currently set response status as http::StatusCode.
sourcepub fn status_mut(&mut self) -> &mut StatusCode
pub fn status_mut(&mut self) -> &mut StatusCode
Access the currently set response status as mutable http::StatusCode.
sourcepub fn set_status(&mut self, status: StatusCode) -> &mut Self
pub fn set_status(&mut self, status: StatusCode) -> &mut Self
Set the response status (chainable).
sourcepub async fn send(self, body: impl AsRef<[u8]>) -> Result<()>
pub async fn send(self, body: impl AsRef<[u8]>) -> Result<()>
Send the request with the specified body. See Self::body for sending a response with a streaming body.
sourcepub async fn body(self) -> Result<BodyEncode<IO>>
pub async fn body(self) -> Result<BodyEncode<IO>>
Move on to sending body after sending response head.
Auto Trait Implementations§
impl<IO> RefUnwindSafe for HttpResponse<IO>where IO: RefUnwindSafe,
impl<IO> Send for HttpResponse<IO>where IO: Send,
impl<IO> Sync for HttpResponse<IO>where IO: Sync,
impl<IO> Unpin for HttpResponse<IO>
impl<IO> UnwindSafe for HttpResponse<IO>where IO: UnwindSafe,
Blanket Implementations§
§impl<'a, T> AsTaggedExplicit<'a> for Twhere
T: 'a,
impl<'a, T> AsTaggedExplicit<'a> for Twhere T: 'a,
§impl<'a, T> AsTaggedImplicit<'a> for Twhere
T: 'a,
impl<'a, T> AsTaggedImplicit<'a> for Twhere T: 'a,
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