我正在使用Rocket框架,并且我想在我的处理程序中进行异步HTTP请求,就像这样:
#[get("/")]
async fn handler() -> String {
some_func().await;
"OK".into()
}
因此,我得到了下一个错误。
the trait `rocket::response::Responder<'_>` is not implemented for `impl core::future::future::Future`
我尝试编写实现代码但失败了。 有没有一种方法来为impl Trait实现trait?
或者可以指定async fn的返回类型,以便我可以返回具有所需特征的自定义类型?