Struct tauri_runtime::http::Response
source · pub struct Response { /* private fields */ }
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)
.mimetype("text/html")
.body("hello!".as_bytes().to_vec())
.unwrap();
Implementations
sourceimpl Response
impl Response
sourcepub fn set_status(&mut self, status: StatusCode)
pub fn set_status(&mut self, status: StatusCode)
Sets the status code.
sourcepub fn status(&self) -> StatusCode
pub fn status(&self) -> StatusCode
Returns the StatusCode
.
sourcepub fn set_mimetype(&mut self, mimetype: Option<String>)
pub fn set_mimetype(&mut self, mimetype: Option<String>)
Sets the mimetype.
sourcepub fn headers_mut(&mut self) -> &mut HeaderMap<HeaderValue>
pub fn headers_mut(&mut self) -> &mut HeaderMap<HeaderValue>
Returns a mutable reference to the associated header field map.
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 Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more