Start adding async-trait
to GraphQLTypeAsync
This commit is contained in:
parent
0f4e9982c5
commit
13bbbe254b
2 changed files with 8 additions and 8 deletions
|
@ -35,18 +35,17 @@ default = [
|
|||
[dependencies]
|
||||
juniper_codegen = { version = "0.14.0", 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" }
|
||||
|
|
|
@ -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 {
|
||||
|
|
Loading…
Reference in a new issue