Warp Routes function return error from hey handler

Hey Guys,
i am trying to pull out routes definition in a separate function using the Warp HttpServer but i get an error in line routes fn of the linked github.com code here:

pub fn routes(
state: AppState,
) -> impl Filter<Extract = impl warp::Reply, Error = warp::Rejection> + Clone {
//See the playgroung link in link 139 for the error

the trait bound impl warp::Future<Output = Result<Json, ErrorResponse>>: Reply is not satisfied
the following other types implement trait Reply:
&'static [u8]
&'static str
Cow<'static, str>
and 17 others
required because of the requirements on the impl of Reply for (impl warp::Future<Output = Result<Json, ErrorResponse>>,)
2 redundant requirements hidden
required because of the requirements on the impl of Reply for (warp::generic::Either<(warp::generic::Either<(&'static str,), (&'static str,)>,), (impl warp::Future<Output = Result<Json, ErrorResponse>>,)>,)

There are several syntax errors in the provided code playground. Can you fix them so that we have a clearer picture of where the issue is?

hey @moy2010 check out the git public repo for the whole code

This error:

the trait bound `impl warp::Future<Output = Result<Json, ErrorResponse>>: Reply` is not satisfied

is originated because of this line in hello/src/response.rs:

pub type Response = std::result::Result<warp::reply::Json, ErrorResponse>;

and what the error is telling you is that the type warp::reply::Json doesn't implement the Reply trait.

Did you copy this code from some guide or tutorial?

If you want to move fast, change that line for this one:

pub type Response = std::result::Result<Box<dyn warp::Reply>, ErrorResponse>;