pub struct WebResponse { /* private fields */ }Expand description
This represents a response from a web function. When constructed, it’s a 200 response with no headers or body. You can set the status, headers, and body via WebResponse::with_status, WebResponse::with_headers, and WebResponse::with_body respectfully.
Implementations§
Source§impl WebResponse
impl WebResponse
Sourcepub fn with_status(self, status: u16) -> Self
pub fn with_status(self, status: u16) -> Self
Sets the response status.
Sourcepub fn header(self, key: impl Into<String>, value: impl Into<String>) -> Self
pub fn header(self, key: impl Into<String>, value: impl Into<String>) -> Self
Adds a header to the response.
Sourcepub fn with_headers(self, headers: Vec<(String, String)>) -> Self
pub fn with_headers(self, headers: Vec<(String, String)>) -> Self
Overrides the collection of headers for the response.
Trait Implementations§
Source§impl Debug for WebResponse
impl Debug for WebResponse
Source§impl Default for WebResponse
impl Default for WebResponse
Source§impl IntoWebResponse for WebResponse
impl IntoWebResponse for WebResponse
Auto Trait Implementations§
impl Freeze for WebResponse
impl RefUnwindSafe for WebResponse
impl Send for WebResponse
impl Sync for WebResponse
impl Unpin for WebResponse
impl UnwindSafe for WebResponse
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