pub struct Response {
pub status: StatusCode,
pub headers: HeaderMap,
pub body: Bytes,
/* private fields */
}Expand description
HTTP Response wrapper
Fields§
§status: StatusCode§headers: HeaderMap§body: BytesImplementations§
Source§impl Response
impl Response
pub fn new(status: StatusCode) -> Self
Set a cookie
pub fn ok() -> Self
pub fn with_body(self, body: impl Into<Bytes>) -> Self
pub fn with_header( self, key: impl Into<String>, value: impl Into<String>, ) -> Self
pub fn json<T: Serialize>(data: T) -> Self
pub fn text(text: impl Into<String>) -> Self
pub fn from_error(error: Error) -> Self
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for Response
impl RefUnwindSafe for Response
impl Send for Response
impl Sync for Response
impl Unpin for Response
impl UnsafeUnpin for Response
impl UnwindSafe for Response
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