pub struct HttpResponseBuilder<State> { /* private fields */ }Implementations§
Source§impl HttpResponseBuilder<SetStatus>
impl HttpResponseBuilder<SetStatus>
pub fn status(self, status: u16) -> HttpResponseBuilder<Final>
Source§impl HttpResponseBuilder<Final>
impl HttpResponseBuilder<Final>
Sourcepub fn body_empty(self) -> Result<HttpResponse>
pub fn body_empty(self) -> Result<HttpResponse>
Finish the builder and the create the response with an empty body.
Sourcepub fn body_boxed(self, body: BoxBody<Bytes, Error>) -> Result<HttpResponse>
pub fn body_boxed(self, body: BoxBody<Bytes, Error>) -> Result<HttpResponse>
Finish the builder and the create the response with a boxed body.
Used for moving a body from another request or response.
Sourcepub fn body_bytes(self, body: impl Into<Bytes>) -> Result<HttpResponse>
pub fn body_bytes(self, body: impl Into<Bytes>) -> Result<HttpResponse>
Finish the builder and the create the response with a body of bytes in memory.
Sourcepub fn body_stream<S>(self, stream: S) -> Result<HttpResponse>
pub fn body_stream<S>(self, stream: S) -> Result<HttpResponse>
Finish the builder and the create the response with a body of bytes as a stream.
Sourcepub fn header(self, key: impl Into<String>, value: impl Into<String>) -> Self
pub fn header(self, key: impl Into<String>, value: impl Into<String>) -> Self
Add a header to the response.
Sourcepub fn headers(self, headers: &HeaderMap<HeaderValue>) -> Self
pub fn headers(self, headers: &HeaderMap<HeaderValue>) -> Self
Copy headers from another request or response.
Auto Trait Implementations§
impl<State> Freeze for HttpResponseBuilder<State>
impl<State> !RefUnwindSafe for HttpResponseBuilder<State>
impl<State> Send for HttpResponseBuilder<State>where
State: Send,
impl<State> Sync for HttpResponseBuilder<State>where
State: Sync,
impl<State> Unpin for HttpResponseBuilder<State>where
State: Unpin,
impl<State> UnsafeUnpin for HttpResponseBuilder<State>
impl<State> !UnwindSafe for HttpResponseBuilder<State>
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