Hiya, I'm trying to get juniper working with warp. I followed the example on juniper_warp docs but the program doesn't compile for me.
struct Context {
db: Arc<Dgraph>,
}
impl juniper::Context for Context {}
type Schema = RootNode<'static, QueryRoot, EmptyMutation<Context>>;
fn schema() -> Schema {
Schema::new(QueryRoot {}, EmptyMutation::<Context>::new())
}
#[tokio::main]
async fn main() {
let state = warp::any().map(move || Context {
db: Arc::new(make_dgraph!(dgraph::new_dgraph_client("localhost:9080"))),
});
let context_extractor = state.boxed();
let filter = warp::path("graphql").and(juniper_warp::make_graphql_filter(
schema(),
context_extractor
));
let routes = warp::any().map(|| "hello, world");
warp::serve(routes).run(([127, 0, 0, 1], 3000)).await;
}
The program fails to compile at let context_extractor = state.boxed()
and let filter = warp::path("graphql").and(juniper_warp::make_graphql_filter( schema(), context_extractor ))
.
The error I keep getting is
The versions of packages I'm using are
warp = "0.2.1"
futures = "0.3.4"
juniper = "0.14.2"
juniper_warp = "0.5.2"