From c5e9f9ead58ef0b88488023ce9825a97ce5051f8 Mon Sep 17 00:00:00 2001 From: rimutaka Date: Tue, 31 May 2022 13:55:23 +1200 Subject: [PATCH] Added impl GraphQLValueAsync for HashSet --- juniper/src/types/containers.rs | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/juniper/src/types/containers.rs b/juniper/src/types/containers.rs index b2355742..e8b6d6e0 100644 --- a/juniper/src/types/containers.rs +++ b/juniper/src/types/containers.rs @@ -1,4 +1,5 @@ use std::{ + collections::HashSet, mem::{self, MaybeUninit}, ptr, }; @@ -220,7 +221,7 @@ where } } -impl GraphQLType for std::collections::HashSet +impl GraphQLType for HashSet where T: GraphQLType, S: ScalarValue, @@ -237,7 +238,7 @@ where } } -impl GraphQLValue for std::collections::HashSet +impl GraphQLValue for HashSet where T: GraphQLValue, S: ScalarValue, @@ -259,6 +260,24 @@ where } } +impl GraphQLValueAsync for HashSet +where + T: GraphQLValueAsync, + T::TypeInfo: Sync, + T::Context: Sync, + S: ScalarValue + Send + Sync, +{ + fn resolve_async<'a>( + &'a self, + info: &'a Self::TypeInfo, + _: Option<&'a [Selection]>, + executor: &'a Executor, + ) -> crate::BoxFuture<'a, ExecutionResult> { + let f = resolve_into_list_async(executor, info, self.iter()); + Box::pin(f) + } +} + impl GraphQLType for [T] where S: ScalarValue,