[−][src]Struct tide::Response
An HTTP response
Methods
impl Response
[src]
pub fn new(status: StatusCode) -> Self
[src]
Create a new instance.
pub fn with_reader<R>(status: u16, reader: R) -> Self where
R: BufRead + Unpin + Send + Sync + 'static,
[src]
R: BufRead + Unpin + Send + Sync + 'static,
Create a new instance from a reader.
pub fn status(&self) -> StatusCode
[src]
Returns the statuscode.
pub fn set_status(self, status: StatusCode) -> Self
[src]
Set the statuscode.
pub fn set_header(self, key: HeaderName, value: impl AsRef<str>) -> Self
[src]
Insert an HTTP header.
pub fn append_header(self, key: HeaderName, value: impl AsRef<str>) -> Self
[src]
Append an HTTP header.
pub fn set_mime(self, mime: Mime) -> Self
[src]
Set the request MIME.
pub fn body_string(self, string: String) -> Self
[src]
pub fn body<R>(self, reader: R) -> Self where
R: BufRead + Unpin + Send + Sync + 'static,
[src]
R: BufRead + Unpin + Send + Sync + 'static,
pub async fn body_form<T: Serialize>(
__arg0: Self,
form: T
) -> Result<Response, Error>
[src]
__arg0: Self,
form: T
) -> Result<Response, Error>
Encode a struct as a form and set as the response body.
Mime
The encoding is set to application/x-www-form-urlencoded
.
pub fn body_json(self, json: &impl Serialize) -> Result<Self>
[src]
Encode a struct as a form and set as the response body.
Mime
The encoding is set to application/json
.
pub fn set_cookie(&mut self, cookie: Cookie<'static>)
[src]
Add cookie to the cookie jar.
pub fn remove_cookie(&mut self, cookie: Cookie<'static>)
[src]
Removes the cookie. This instructs the CookiesMiddleware
to send a cookie with empty value
in the response.
pub fn local<T: Send + Sync + 'static>(&self) -> Option<&T>
[src]
Get a local value.
pub fn set_local<T: Send + Sync + 'static>(self, val: T) -> Self
[src]
Set a local value.
Trait Implementations
impl Debug for Response
[src]
impl From<Response> for Error
[src]
impl IntoIterator for Response
[src]
type Item = (HeaderName, Vec<HeaderValue>)
The type of the elements being iterated over.
type IntoIter = IntoIter
Which kind of iterator are we turning this into?
fn into_iter(self) -> Self::IntoIter
[src]
Returns a iterator of references over the remaining items.
impl<'a> IntoIterator for &'a Response
[src]
type Item = (&'a HeaderName, &'a Vec<HeaderValue>)
The type of the elements being iterated over.
type IntoIter = Iter<'a>
Which kind of iterator are we turning this into?
fn into_iter(self) -> Self::IntoIter
[src]
impl<'a> IntoIterator for &'a mut Response
[src]
type Item = (&'a HeaderName, &'a mut Vec<HeaderValue>)
The type of the elements being iterated over.
type IntoIter = IterMut<'a>
Which kind of iterator are we turning this into?
fn into_iter(self) -> Self::IntoIter
[src]
impl IntoResponse for Response
[src]
fn into_response(self) -> Response
[src]
fn with_status(self, status: StatusCode) -> WithStatus<Self>
[src]
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
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<I> IntoIterator for I where
I: Iterator,
[src]
I: Iterator,
type Item = <I as Iterator>::Item
The type of the elements being iterated over.
type IntoIter = I
Which kind of iterator are we turning this into?
fn into_iter(self) -> I
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,