Trait viz_core::ResponseExt
source · [−]pub trait ResponseExt {
fn ok(&self) -> bool;
fn location(location: &'static str) -> Self;
fn redirect<T>(url: T) -> Response
where
T: AsRef<str>;
fn redirect_with_status<T>(uri: T, status: StatusCode) -> Response
where
T: AsRef<str>;
fn with<T>(t: T, c: &'static str) -> Response
where
T: Into<Body>,
{ ... }
fn text<T>(t: T) -> Response
where
T: Into<Body>,
{ ... }
fn html<T>(t: T) -> Response
where
T: Into<Body>,
{ ... }
fn json<T>(t: T) -> Result<Response, PayloadError>
where
T: Serialize,
{ ... }
fn stream<S, O, E>(s: S) -> Response
where
S: Stream<Item = Result<O, E>> + Send + 'static,
O: Into<Bytes> + 'static,
E: Error + Send + Sync + 'static,
{ ... }
fn see_other<T>(url: T) -> Response
where
T: AsRef<str>,
{ ... }
fn temporary<T>(url: T) -> Response
where
T: AsRef<str>,
{ ... }
fn permanent<T>(url: T) -> Response
where
T: AsRef<str>,
{ ... }
}
Required Methods
The response redirects to the specified URL.
fn redirect_with_status<T>(uri: T, status: StatusCode) -> Response where
T: AsRef<str>,
fn redirect_with_status<T>(uri: T, status: StatusCode) -> Response where
T: AsRef<str>,
The response redirects to the specified URL and the status code.
Provided Methods
Response body with Content-Type
Available on crate feature
json
only.Response JSON
Response Stream