pub struct HttpResponse {
pub status: u16,
pub status_text: &'static str,
pub headers: Vec<(String, String)>,
pub body: Vec<u8>,
}Expand description
HTTP response.
Fields§
§status: u16§status_text: &'static str§headers: Vec<(String, String)>§body: Vec<u8>Implementations§
Source§impl HttpResponse
impl HttpResponse
pub fn json(status: u16, status_text: &'static str, body: &Value) -> Self
pub fn ok(body: Value) -> Self
pub fn html(body: &str) -> Self
pub fn created(body: Value) -> Self
pub fn bad_request(msg: &str) -> Self
pub fn not_found() -> Self
pub fn internal_error(msg: &str) -> Self
pub fn bytes( status: u16, status_text: &'static str, content_type: &'static str, body: Vec<u8>, ) -> Self
Auto Trait Implementations§
impl Freeze for HttpResponse
impl RefUnwindSafe for HttpResponse
impl Send for HttpResponse
impl Sync for HttpResponse
impl Unpin for HttpResponse
impl UnsafeUnpin 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
Source§impl<T> InterfaceConfigData for Twhere
T: Send + 'static,
impl<T> InterfaceConfigData for Twhere
T: Send + 'static,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more