pub struct ResponseHandler { /* private fields */ }Implementations§
Source§impl ResponseHandler
impl ResponseHandler
Sourcepub fn into_response(
self,
request_headers: &HeaderMap,
) -> Result<Response<BoxBody>, Error>
pub fn into_response( self, request_headers: &HeaderMap, ) -> Result<Response<BoxBody>, Error>
build response
Sourcepub fn with_status(self, status: &StatusCode) -> Self
pub fn with_status(self, status: &StatusCode) -> Self
set http status code
Sourcepub fn with_header(
self,
key: impl Into<String>,
value: Option<impl Into<String>>,
) -> Self
pub fn with_header( self, key: impl Into<String>, value: Option<impl Into<String>>, ) -> Self
add custom header
Sourcepub fn with_headers<K, V, I>(self, headers: I) -> Self
pub fn with_headers<K, V, I>(self, headers: I) -> Self
add custom headers
Sourcepub fn with_text(
self,
text: impl Into<String>,
content_type: Option<&str>,
) -> Self
pub fn with_text( self, text: impl Into<String>, content_type: Option<&str>, ) -> Self
add text to body
Sourcepub fn with_json_body(self, body: impl Into<String>) -> Self
pub fn with_json_body(self, body: impl Into<String>) -> Self
treat response as json
Trait Implementations§
Source§impl Default for ResponseHandler
impl Default for ResponseHandler
Source§fn default() -> ResponseHandler
fn default() -> ResponseHandler
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for ResponseHandler
impl !RefUnwindSafe for ResponseHandler
impl Send for ResponseHandler
impl Sync for ResponseHandler
impl Unpin for ResponseHandler
impl UnsafeUnpin for ResponseHandler
impl !UnwindSafe for ResponseHandler
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