Trait gotham::handler::IntoResponse [−][src]
Represents a type which can be converted to a response. This trait is used in converting the return type of a function into a response.
Examples
struct MyStruct { value: String } impl MyStruct { fn new() -> MyStruct { // ... } } impl IntoResponse for MyStruct { fn into_response(self, _state: &State) -> Response<Body> { Response::builder() .status(StatusCode::OK) .body(self.value.into()) .unwrap() } } fn handler(state: State) -> (State, MyStruct) { (state, MyStruct::new()) } tree.add_route(Box::new(route)); Router::new(tree, finalizer);
Required methods
fn into_response(self, state: &State) -> Response<Body>
[src]
Converts this value into a hyper::Response
Implementations on Foreign Types
impl IntoResponse for Response<Body>
[src]
fn into_response(self, _state: &State) -> Response<Body>
[src]
impl<T, E> IntoResponse for Result<T, E> where
T: IntoResponse,
E: IntoResponse,
[src]
T: IntoResponse,
E: IntoResponse,
fn into_response(self, state: &State) -> Response<Body>
[src]
impl<B> IntoResponse for (Mime, B) where
B: Into<Body>,
[src]
B: Into<Body>,
fn into_response(self, state: &State) -> Response<Body>
[src]
impl<B> IntoResponse for (StatusCode, Mime, B) where
B: Into<Body>,
[src]
B: Into<Body>,