pub struct HttpResponse {
pub protocol: String,
pub status_code: u16,
pub status_text: String,
pub headers: HashMap<String, String>,
pub body: Vec<u8>,
}
Fields§
§protocol: String
§status_code: u16
§status_text: String
§headers: HashMap<String, String>
§body: Vec<u8>
Implementations§
Source§impl HttpResponse
impl HttpResponse
pub fn new() -> Self
pub fn ok() -> Self
pub fn found() -> Self
pub fn bad_request() -> Self
pub fn forbidden() -> Self
pub fn not_found() -> Self
pub fn internal_server_error() -> Self
pub fn status(self, code: u16, text: &str) -> Self
pub fn body_bytes(self, body: &[u8]) -> Self
pub fn body_string(self, body: &str) -> Self
pub fn header(self, key: &str, value: &str) -> Self
pub fn body_to_string(&self) -> String
pub fn to_bytes(&self) -> Vec<u8> ⓘ
pub async fn from_stream<S: AsyncRead + Unpin>( stream: &mut S, ) -> Result<HttpResponse>
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