Start adding async-trait to GraphQLTypeAsync

This commit is contained in:
nWacky 2019-11-01 14:26:08 +03:00
parent bfe6c7ae97
commit e03e525645
No known key found for this signature in database
GPG key ID: 22EF2C62F6F79FD0
2 changed files with 8 additions and 8 deletions

View file

@ -35,18 +35,17 @@ default = [
[dependencies]
juniper_codegen = { version = "0.14.1", path = "../juniper_codegen" }
async-trait = "0.1.16"
chrono = { version = "0.4.0", optional = true }
fnv = "1.0.3"
futures-preview = { version = "=0.3.0-alpha.19", optional = true }
indexmap = { version = "1.0.0", features = ["serde-1"] }
serde = { version = "1.0.8" }
serde_derive = { version = "1.0.2" }
chrono = { version = "0.4.0", optional = true }
serde_json = { version="1.0.2", optional = true }
url = { version = "2", optional = true }
uuid = { version = "0.7", optional = true }
futures-preview = { version = "=0.3.0-alpha.19", optional = true }
[dev-dependencies]
bencher = "0.1.2"
serde_json = { version = "1.0.2" }

View file

@ -12,6 +12,7 @@ use crate::BoxFuture;
use super::base::{is_excluded, merge_key_into, Arguments, GraphQLType};
#[async_trait]
pub trait GraphQLTypeAsync<S>: GraphQLType<S> + Send + Sync
where
Self::Context: Send + Sync,
@ -19,22 +20,22 @@ where
S: ScalarValue + Send + Sync,
for<'b> &'b S: ScalarRefValue<'b>,
{
fn resolve_field_async<'a>(
async fn resolve_field_async<'a>(
&'a self,
info: &'a Self::TypeInfo,
field_name: &'a str,
arguments: &'a Arguments<S>,
executor: &'a Executor<Self::Context, S>,
) -> BoxFuture<'a, ExecutionResult<S>> {
) -> ExecutionResult<S> {
panic!("resolve_field must be implemented by object types");
}
fn resolve_async<'a>(
async fn resolve_async<'a>(
&'a self,
info: &'a Self::TypeInfo,
selection_set: Option<&'a [Selection<S>]>,
executor: &'a Executor<Self::Context, S>,
) -> BoxFuture<'a, Value<S>> {
) -> Value<S> {
if let Some(selection_set) = selection_set {
resolve_selection_set_into_async(self, info, selection_set, executor)
} else {