pub struct ResponseBuilder { /* private fields */ }Expand description
Builder pattern for constructing responses.
Implementations§
Source§impl ResponseBuilder
impl ResponseBuilder
Sourcepub fn version(self, version: HttpVersion) -> Self
pub fn version(self, version: HttpVersion) -> Self
Override the HTTP version.
Sourcepub fn header(
self,
name: impl Into<HeaderName>,
value: impl Into<String>,
) -> Self
pub fn header( self, name: impl Into<HeaderName>, value: impl Into<String>, ) -> Self
Append a header value.
Sourcepub fn body(self, body: ResponseBody) -> Self
pub fn body(self, body: ResponseBody) -> Self
Set the response body representation.
Sourcepub fn body_bytes(self, bytes: impl Into<Bytes>) -> Self
pub fn body_bytes(self, bytes: impl Into<Bytes>) -> Self
Provide a fully buffered body payload.
Sourcepub fn body_static(self, bytes: &'static [u8]) -> Self
pub fn body_static(self, bytes: &'static [u8]) -> Self
Provide a static byte slice body payload without copying.
Sourcepub fn text_static(self, text: &'static str) -> Self
pub fn text_static(self, text: &'static str) -> Self
Provide a static UTF-8 string body payload without copying.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for ResponseBuilder
impl !RefUnwindSafe for ResponseBuilder
impl !Sync for ResponseBuilder
impl !UnwindSafe for ResponseBuilder
impl Send for ResponseBuilder
impl Unpin for ResponseBuilder
impl UnsafeUnpin for ResponseBuilder
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