Trait viz::ResponseExt

source ·
pub trait ResponseExt: Sized {
    fn ok(&self) -> bool;
    fn location(location: &'static str) -> Self;
    fn redirect<T>(url: T) -> Response<Body>
    where
        T: AsRef<str>
; fn redirect_with_status<T>(uri: T, status: StatusCode) -> Response<Body>
    where
        T: AsRef<str>
; fn with<T>(t: T, c: &'static str) -> Response<Body>
    where
        T: Into<Body>
, { ... } fn text<T>(t: T) -> Response<Body>
    where
        T: Into<Body>
, { ... } fn html<T>(t: T) -> Response<Body>
    where
        T: Into<Body>
, { ... } fn json<T>(t: T) -> Result<Response<Body>, PayloadError>
    where
        T: Serialize
, { ... } fn stream<S, O, E>(s: S) -> Response<Body>
    where
        S: 'static + Stream<Item = Result<O, E>> + Send,
        O: 'static + Into<Bytes>,
        E: 'static + Error + Send + Sync
, { ... } fn see_other<T>(url: T) -> Response<Body>
    where
        T: AsRef<str>
, { ... } fn temporary<T>(url: T) -> Response<Body>
    where
        T: AsRef<str>
, { ... } fn permanent<T>(url: T) -> Response<Body>
    where
        T: AsRef<str>
, { ... } }
Expand description

The Response Extension.

Required Methods§

The response was successful (status in the range 200-299) or not.

The Content-Location header indicates an alternate location for the returned data.

The response redirects to the specified URL.

The response redirects to the specified URL and the status code.

Provided Methods§

The response with the specified Content-Type.

The response with text/plain; charset=utf-8 media type.

The response with text/html; charset=utf-8 media type.

Available on crate feature json only.

The response with application/javascript; charset=utf-8 media type.

Responds to a stream.

The response redirects to the 303.

The response redirects to the 307.

The response redirects to the 308.

Implementations on Foreign Types§

Implementors§