#[non_exhaustive]pub struct HttpResponse {
pub code: StatusCode,
pub headers: Vec<HttpHeader>,
pub body: HttpBody,
pub content_type: String,
}Expand description
Your response
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.code: StatusCode§headers: Vec<HttpHeader>§body: HttpBody§content_type: StringImplementations§
Source§impl HttpResponse
impl HttpResponse
Sourcepub fn new() -> HttpResponse
pub fn new() -> HttpResponse
An empty response
Sourcepub fn add_header(
&mut self,
name: impl Into<String>,
value: impl Into<String>,
) -> &mut HttpResponse
pub fn add_header( &mut self, name: impl Into<String>, value: impl Into<String>, ) -> &mut HttpResponse
Pushes a new header
Trait Implementations§
Source§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
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