pub struct Response {
pub status: Status,
pub location: Option<Url>,
pub www_authenticate: Option<String>,
pub body: Option<Body>,
}Expand description
Open and simple implementation of WebResponse.
Fields§
§status: StatusHTTP status code.
location: Option<Url>A location header, for example for redirects.
www_authenticate: Option<String>Indicates how the client should have authenticated.
Only set with Unauthorized status.
body: Option<Body>Encoded body of the response.
One variant for each possible encoding type.
Trait Implementations§
Source§impl WebResponse for Response
impl WebResponse for Response
Source§fn redirect(&mut self, url: Url) -> Result<(), Self::Error>
fn redirect(&mut self, url: Url) -> Result<(), Self::Error>
A response which will redirect the user-agent to which the response is issued.
Set the response status to 401 and add a WWW-Authenticate header.
Source§fn body_text(&mut self, text: &str) -> Result<(), Self::Error>
fn body_text(&mut self, text: &str) -> Result<(), Self::Error>
A pure text response with no special media type set.
Source§fn body_json(&mut self, data: &str) -> Result<(), Self::Error>
fn body_json(&mut self, data: &str) -> Result<(), Self::Error>
Json repsonse data, with media type `aplication/json.
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