Trait rweb::Reply [−][src]
pub trait Reply: BoxedReply + Send { fn into_response(self) -> Response<Body>; }
Expand description
Types that can be converted into a Response
.
This trait is implemented for the following:
http::StatusCode
http::Response<impl Into<hyper::Body>>
String
&'static str
Example
use warp::{Filter, http::Response}; struct Message { msg: String } impl warp::Reply for Message { fn into_response(self) -> warp::reply::Response { Response::new(format!("message: {}", self.msg).into()) } } fn handler() -> Message { Message { msg: "Hello".to_string() } } let route = warp::any().map(handler);
Required methods
fn into_response(self) -> Response<Body>
[src]
fn into_response(self) -> Response<Body>
[src]Converts the given value into a Response
.