I've been working on a new API and it has been a while. I've copied over some old code but for some reason I keep getting errors I have never seen on the old API.
.or(health_route)
| | -^^ method cannot be called due to unsatisfied trait bounds
| |_____________________|
And for example:
error[E0277]: the trait bound Box<(dyn std::error::Error + Send + Sync + 'static)>: reject::sealed::CombineRejection<Rejection>
is not satisfied.
While this was working fine on my old API.
Example snippet:
let health_route = warp::path("health")
.and(warp::get()).
and_then(health_check);
async fn health_check() -> std::result::Result<impl warp::Reply, warp::Rejection> {
Ok(warp::reply::json(&"Service is up and running"))
}
warp::serve(routes)
.run(([0, 0, 0, 0], 3030))
.await;
This very simple health check I can' even get to work due to FilterBase or Filter not being satisfied! Error:
.or(health_route)
| | -^^ method cannot be called due to unsatisfied trait bounds
12 | pub struct AndThen<T, F> {
| ------------------------ doesn't satisfy `_: FilterBase` or `_: Filter`
Please help me!