1

Warp 正在返回错误,

error[E0277]: the trait bound `impl warp::Future: warp::filter::FilterBase` is not satisfied
  --> src/http.rs:31:26
   |
31 |     let routes = index().or(users());
   |                             ^^^^^^^ the trait `warp::filter::FilterBase` is not implemented for `impl warp::Future`

我基本上有这个,

pub async fn users() -> impl Filter<Extract = impl warp::Reply, Error = warp::Rejection> + Clone {
  # stuff
}

我究竟做错了什么?

4

1 回答 1

-1

or接受一个返回 a 的函数Filter。您的函数被标记async,并返回一个Future<Output = Filter>. 您可以改为使用or_else的异步版本or

let routes = index().or_else(users());
于 2021-05-06T23:21:20.113 回答