[][src]Struct hightide::Response

pub struct Response { /* fields omitted */ }

A wrapper over tide::Response with better ergonomics

use hightide::{Responder, Response};
use tide::Request;
fn example(_: Request<()>) -> impl Responder {
    Response::ok().json(MyData{...})
}

Implementations

impl Response[src]

pub fn ok() -> Self[src]

Create an empty response with status code OK (200)

pub fn status(s: StatusCode) -> Self[src]

Create an empty response with the given status code

pub fn body(self, body: impl Into<Body>) -> Self[src]

Set the body of the response

pub fn json(self, body: impl Serialize) -> Result<Self>[src]

Set the body of the response to a JSON payload

pub fn form(self, body: impl Serialize) -> Result<Self>[src]

Set the body of the response to form data

pub fn header<H: Header + Display>(self, h: H) -> Self[src]

Set a header (from the hyperx typed headers)

pub fn raw_header(
    self,
    name: impl Into<HeaderName>,
    key: impl ToHeaderValues
) -> Self
[src]

Set a raw header (from the http_types crate)

pub fn into_inner(self) -> Response[src]

Consume this response and return the inner tide::Response

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

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,