pub struct Response {
pub status: Status,
pub headers: HeaderMap,
pub body: Vec<u8>,
/* private fields */
}
Expand description
HTTP response
Fields§
§status: Status
Status
headers: HeaderMap
Headers
body: Vec<u8>
Body
Implementations§
Source§impl Response
impl Response
Sourcepub fn with_status(status: Status) -> Self
pub fn with_status(status: Status) -> Self
Create new response with status
Sourcepub fn with_header(name: impl Into<String>, value: impl Into<String>) -> Self
pub fn with_header(name: impl Into<String>, value: impl Into<String>) -> Self
Create new response with header
Sourcepub fn with_redirect(location: impl Into<String>) -> Self
pub fn with_redirect(location: impl Into<String>) -> Self
Create new response with redirect header
Sourcepub fn takeover(self, f: impl FnOnce(TcpStream) + Send + 'static) -> Self
pub fn takeover(self, f: impl FnOnce(TcpStream) + Send + 'static) -> Self
Set takeover function
Sourcepub fn read_from_stream(
stream: &mut dyn Read,
) -> Result<Self, InvalidResponseError>
pub fn read_from_stream( stream: &mut dyn Read, ) -> Result<Self, InvalidResponseError>
Read response from stream
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Response
impl !RefUnwindSafe for Response
impl Send for Response
impl !Sync for Response
impl Unpin for Response
impl !UnwindSafe for Response
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