Struct highnoon::response::Response[][src]

pub struct Response { /* fields omitted */ }

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 set_status(&mut self, s: StatusCode)[src]

Set the status code of a response

pub fn get_status(&self) -> StatusCode[src]

Get the status code of a response

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

Set the body of the response

pub fn reader(mut self: Self, r: impl AsyncRead + Send + 'static) -> Self[src]

Set the body to an AsyncRead object

pub async fn path(self, path: impl AsRef<Path>) -> Result<Self>[src]

Set the body to the content of a file given by a Path Also sets a content type by guessing the mime type from the path name

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

Set the body of the response to a JSON payload

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

Set the body of the response to form data

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

Set a header (from the headers crate)

pub fn set_header<H: Header>(&mut self, h: H)[src]

Set a header (without consuming self - useful outside of method chains)

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

Set a raw header (from the http crate)

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

Consume this response and return the inner hyper::Response

Trait Implementations

impl Debug for Response[src]

impl From<Response<Body>> for Response[src]

impl Responder for Response[src]

Identity implementation

Auto Trait Implementations

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> Instrument for T[src]

impl<T> Instrument 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>,