pub struct HttpResponse {
pub headers: HashMap<String, String>,
pub status: HttpStatus,
pub body: Option<String>,
}Expand description
Struct that contains all the information that will be sent to the client
Fields§
§headers: HashMap<String, String>§status: HttpStatus§body: Option<String>Implementations§
Source§impl HttpResponse
impl HttpResponse
pub fn new_body(body: String, status: HttpStatus) -> Self
pub fn insert_header( self, key: impl Into<String>, value: impl Into<String>, ) -> Self
pub fn set_body(self, body: impl Into<String>) -> Self
pub fn set_status(self, status: HttpStatus) -> Self
pub fn new() -> Self
Trait Implementations§
Source§impl Clone for HttpResponse
impl Clone for HttpResponse
Source§fn clone(&self) -> HttpResponse
fn clone(&self) -> HttpResponse
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for HttpResponse
impl Debug for HttpResponse
Source§impl Default for HttpResponse
impl Default for HttpResponse
Source§fn default() -> HttpResponse
fn default() -> HttpResponse
Returns the “default value” for a type. Read more
Source§impl PartialEq for HttpResponse
impl PartialEq for HttpResponse
impl Eq for HttpResponse
impl StructuralPartialEq for HttpResponse
Auto Trait Implementations§
impl Freeze for HttpResponse
impl RefUnwindSafe for HttpResponse
impl Send for HttpResponse
impl Sync for HttpResponse
impl Unpin for HttpResponse
impl UnwindSafe for HttpResponse
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