pub struct ResponseWriter {
pub http_version: String,
pub status: u32,
pub status_text: String,
pub headers: HashMap<String, String>,
pub body: Option<Vec<u8>>,
}Expand description
State that writes a response to the socket and then returns control to the custom_handler_state.
Fields§
§http_version: String§status: u32§status_text: String§headers: HashMap<String, String>§body: Option<Vec<u8>>Implementations§
Source§impl ResponseWriter
impl ResponseWriter
pub fn new() -> Self
pub fn with_status(self, code: u32, text: impl Into<String>) -> Self
pub fn with_version(self, ver: impl Into<String>) -> Self
pub fn with_header( self, name: impl Into<String>, val: impl Into<String>, ) -> Self
pub fn with_body(self, body: Vec<u8>) -> Self
pub fn without_body(self) -> Self
Trait Implementations§
Source§impl ConnectionState for ResponseWriter
impl ConnectionState for ResponseWriter
fn handle( self: Box<Self>, client: &mut Connection, ) -> Option<Box<dyn ConnectionState>>
Auto Trait Implementations§
impl Forget for ResponseWriter
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