pub struct Response {
pub head: ResponseParts,
pub body: Vec<u8>,
}
Expand description
Represents an HTTP response
An HTTP response consists of a head and a potentially body.
Platform-specific
- Linux: Headers and status code cannot be changed.
Examples
let response = ResponseBuilder::new()
.status(202)
.body("hello!".as_bytes().to_vec())
.unwrap();
Fields
head: ResponseParts
body: Vec<u8>
Implementations
sourceimpl Response
impl Response
sourcepub fn status(&self) -> StatusCode
pub fn status(&self) -> StatusCode
Returns the StatusCode
.
sourcepub fn headers(&self) -> &HeaderMap<HeaderValue>
pub fn headers(&self) -> &HeaderMap<HeaderValue>
Returns a reference to the associated header field map.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Response
impl Send for Response
impl Sync for Response
impl Unpin for Response
impl UnwindSafe for Response
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more