pub struct HttpResponse {
pub status_code: u16,
pub status_text: String,
pub headers: HashMap<String, String>,
pub body: Vec<u8>,
}Fields§
§status_code: u16§status_text: String§headers: HashMap<String, String>§body: Vec<u8>Implementations§
Source§impl HttpResponse
impl HttpResponse
pub fn new(status_code: u16, status_text: String) -> Self
pub fn ok() -> Self
pub fn not_found() -> Self
pub fn bad_request() -> Self
pub fn internal_server_error() -> Self
pub fn with_body(self, body: Vec<u8>) -> Self
pub fn with_json(self, json: &str) -> Self
pub fn with_html(self, html: &str) -> Self
pub fn with_header(self, key: String, value: String) -> Self
pub fn with_cors_allow_all(self) -> Self
pub fn to_bytes(&self) -> Vec<u8> ⓘ
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 moreAuto 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