pub struct ResponseWriter {
pub body: String,
pub headers: HeaderMap,
pub status: StatusCode,
pub has_error: bool,
}Fields§
§body: String§headers: HeaderMap§status: StatusCode§has_error: boolImplementations§
Source§impl ResponseWriter
impl ResponseWriter
pub fn new() -> Self
pub fn status(&mut self, status: StatusCode) -> &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 async fn file<P: AsRef<Path>>(&mut self, path: P)
pub fn bytes(&mut self, bytes: &[u8]) -> &mut Self
pub fn get_code(&self, code: StatusCode) -> u16
pub fn error(&mut self, status: StatusCode, msg: &str) -> &mut Self
pub fn has_error(&self) -> bool
pub fn into_response(&self) -> Response<Full<Bytes>>
pub fn strip_header(&mut self, key: &str)
Auto Trait Implementations§
impl Freeze for ResponseWriter
impl RefUnwindSafe for ResponseWriter
impl Send for ResponseWriter
impl Sync for ResponseWriter
impl Unpin for ResponseWriter
impl UnsafeUnpin 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