pub struct ResponseWriter {
pub body: String,
pub headers: HeaderMap,
pub status: u16,
pub has_error: bool,
}Fields§
§body: String§headers: HeaderMap§status: u16§has_error: boolImplementations§
Source§impl ResponseWriter
impl ResponseWriter
pub fn new() -> Self
pub fn status(&mut self, status: u16) -> &mut Self
pub fn set_header(&mut self, key: &str, value: &str) -> &mut Self
pub fn get_header(&self, key: &str) -> Option<&HeaderValue>
pub fn send(&mut self, body: &str) -> &mut Self
pub fn json<T: Serialize>(&mut self, data: &T) -> &mut Self
pub fn html(&mut self, html: &str) -> &mut Self
pub fn bytes(&mut self, bytes: &[u8]) -> &mut Self
pub fn error(&mut self, status: u16, msg: &str) -> &mut Self
pub fn has_error(&self) -> bool
pub fn into_response(self) -> Response<Full<Bytes>>
Auto Trait Implementations§
impl Freeze for ResponseWriter
impl RefUnwindSafe for ResponseWriter
impl Send for ResponseWriter
impl Sync for ResponseWriter
impl Unpin for ResponseWriter
impl UnwindSafe for ResponseWriter
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