[−][src]Struct hightide::Response
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]
self,
name: impl Into<HeaderName>,
key: impl ToHeaderValues
) -> Self
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]
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<T> Same<T> for T
type Output = T
Should always be Self
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>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,