async-graphql / examples

217 stars 54 forks source link

我尝试直接使用schema.execute(req.into_inner()).await 出现错误 #42

Closed dragon-D closed 2 years ago

dragon-D commented 2 years ago

cargo.toml

actix-web = { version = "4.0.0-beta.9", features = ["openssl"] }
#async-graphql = { git = "https://github.com/async-graphql/async-graphql", features = ["dataloader",], branch="master" }
async-graphql = "2.10.2"
async-graphql-actix-web = { git = "https://github.com/async-graphql/async-graphql", branch = "actix-web-v4-beta" }
actix-files = "0.6.0-beta.6"
actix-http = "3.0.0-beta.8"
actix-service = "2.0.0"
actix-cors = "0.6.0-beta.2"
actix-server = "2.0.0-beta.5"

测试代码就是简单的actix_web

async fn index1(schema: web::Data<StarWarsSchema>, req: Request) -> Response {
   // let request = req.into_inner();
   // let request = request.query;
    schema.execute(req.into_inner()).await.into()
}

会提示` the trait `From<async_graphql::request::Request>` is not implemented for `std::string::String`

只有使用

    let request = req.into_inner();
    let request = request.query;
    schema.execute(request).await.into()

才可以。请问我的使用方法是不是错误