@@ -22,7 +22,12 @@ use crate::{
2222 } ,
2323 model:: { RootNode , SchemaType , TypeType } ,
2424 } ,
25- types:: { base:: GraphQLType , name:: Name } ,
25+ types:: {
26+ async_await:: { GraphQLTypeAsync , GraphQLValueAsync } ,
27+ base:: { GraphQLType , GraphQLValue } ,
28+ name:: Name ,
29+ subscriptions:: { GraphQLSubscriptionType , GraphQLSubscriptionValue } ,
30+ } ,
2631 value:: { DefaultScalarValue , ParseScalarValue , ScalarValue , Value } ,
2732 GraphQLError ,
2833} ;
@@ -244,7 +249,7 @@ impl<S> IntoFieldError<S> for FieldError<S> {
244249#[ doc( hidden) ]
245250pub trait IntoResolvable < ' a , S , T , C >
246251where
247- T : GraphQLType < S > ,
252+ T : GraphQLValue < S > ,
248253 S : ScalarValue ,
249254{
250255 #[ doc( hidden) ]
@@ -253,7 +258,7 @@ where
253258
254259impl < ' a , S , T , C > IntoResolvable < ' a , S , T , C > for T
255260where
256- T : GraphQLType < S > ,
261+ T : GraphQLValue < S > ,
257262 S : ScalarValue ,
258263 T :: Context : FromContext < C > ,
259264{
@@ -265,7 +270,7 @@ where
265270impl < ' a , S , T , C , E : IntoFieldError < S > > IntoResolvable < ' a , S , T , C > for Result < T , E >
266271where
267272 S : ScalarValue ,
268- T : GraphQLType < S > ,
273+ T : GraphQLValue < S > ,
269274 T :: Context : FromContext < C > ,
270275{
271276 fn into ( self , ctx : & ' a C ) -> FieldResult < Option < ( & ' a T :: Context , T ) > , S > {
@@ -277,7 +282,7 @@ where
277282impl < ' a , S , T , C > IntoResolvable < ' a , S , T , C > for ( & ' a T :: Context , T )
278283where
279284 S : ScalarValue ,
280- T : GraphQLType < S > ,
285+ T : GraphQLValue < S > ,
281286{
282287 fn into ( self , _: & ' a C ) -> FieldResult < Option < ( & ' a T :: Context , T ) > , S > {
283288 Ok ( Some ( self ) )
@@ -287,7 +292,7 @@ where
287292impl < ' a , S , T , C > IntoResolvable < ' a , S , Option < T > , C > for Option < ( & ' a T :: Context , T ) >
288293where
289294 S : ScalarValue ,
290- T : GraphQLType < S > ,
295+ T : GraphQLValue < S > ,
291296{
292297 fn into ( self , _: & ' a C ) -> FieldResult < Option < ( & ' a T :: Context , Option < T > ) > , S > {
293298 Ok ( self . map ( |( ctx, v) | ( ctx, Some ( v) ) ) )
@@ -297,7 +302,7 @@ where
297302impl < ' a , S , T , C > IntoResolvable < ' a , S , T , C > for FieldResult < ( & ' a T :: Context , T ) , S >
298303where
299304 S : ScalarValue ,
300- T : GraphQLType < S > ,
305+ T : GraphQLValue < S > ,
301306{
302307 fn into ( self , _: & ' a C ) -> FieldResult < Option < ( & ' a T :: Context , T ) > , S > {
303308 self . map ( Some )
@@ -308,7 +313,7 @@ impl<'a, S, T, C> IntoResolvable<'a, S, Option<T>, C>
308313 for FieldResult < Option < ( & ' a T :: Context , T ) > , S >
309314where
310315 S : ScalarValue ,
311- T : GraphQLType < S > ,
316+ T : GraphQLValue < S > ,
312317{
313318 fn into ( self , _: & ' a C ) -> FieldResult < Option < ( & ' a T :: Context , Option < T > ) > , S > {
314319 self . map ( |o| o. map ( |( ctx, v) | ( ctx, Some ( v) ) ) )
@@ -369,7 +374,7 @@ where
369374 ' i : ' res ,
370375 ' v : ' res ,
371376 ' a : ' res ,
372- T : crate :: GraphQLSubscriptionType < S , Context = CtxT > + Send + Sync ,
377+ T : GraphQLSubscriptionValue < S , Context = CtxT > + Send + Sync ,
373378 T :: TypeInfo : Send + Sync ,
374379 CtxT : Send + Sync ,
375380 S : Send + Sync ,
@@ -393,7 +398,7 @@ where
393398 where
394399 ' t : ' res ,
395400 ' a : ' res ,
396- T : crate :: GraphQLSubscriptionType < S , Context = CtxT > ,
401+ T : GraphQLSubscriptionValue < S , Context = CtxT > ,
397402 T :: TypeInfo : Send + Sync ,
398403 CtxT : Send + Sync ,
399404 S : Send + Sync ,
@@ -405,7 +410,7 @@ where
405410 pub fn resolve_with_ctx < NewCtxT , T > ( & self , info : & T :: TypeInfo , value : & T ) -> ExecutionResult < S >
406411 where
407412 NewCtxT : FromContext < CtxT > ,
408- T : GraphQLType < S , Context = NewCtxT > + ?Sized ,
413+ T : GraphQLValue < S , Context = NewCtxT > + ?Sized ,
409414 {
410415 self . replaced_context ( <NewCtxT as FromContext < CtxT > >:: from ( self . context ) )
411416 . resolve ( info, value)
@@ -414,15 +419,15 @@ where
414419 /// Resolve a single arbitrary value into an `ExecutionResult`
415420 pub fn resolve < T > ( & self , info : & T :: TypeInfo , value : & T ) -> ExecutionResult < S >
416421 where
417- T : GraphQLType < S , Context = CtxT > + ?Sized ,
422+ T : GraphQLValue < S , Context = CtxT > + ?Sized ,
418423 {
419424 value. resolve ( info, self . current_selection_set , self )
420425 }
421426
422427 /// Resolve a single arbitrary value into an `ExecutionResult`
423428 pub async fn resolve_async < T > ( & self , info : & T :: TypeInfo , value : & T ) -> ExecutionResult < S >
424429 where
425- T : crate :: GraphQLTypeAsync < S , Context = CtxT > + Send + Sync + ?Sized ,
430+ T : GraphQLValueAsync < S , Context = CtxT > + Send + Sync + ?Sized ,
426431 T :: TypeInfo : Send + Sync ,
427432 CtxT : Send + Sync ,
428433 S : Send + Sync ,
@@ -439,7 +444,7 @@ where
439444 value : & T ,
440445 ) -> ExecutionResult < S >
441446 where
442- T : crate :: GraphQLTypeAsync < S , Context = NewCtxT > + Send + Sync ,
447+ T : GraphQLValueAsync < S , Context = NewCtxT > + Send + Sync ,
443448 T :: TypeInfo : Send + Sync ,
444449 S : Send + Sync ,
445450 NewCtxT : FromContext < CtxT > + Send + Sync ,
@@ -453,23 +458,20 @@ where
453458 /// If the field fails to resolve, `null` will be returned.
454459 pub fn resolve_into_value < T > ( & self , info : & T :: TypeInfo , value : & T ) -> Value < S >
455460 where
456- T : GraphQLType < S , Context = CtxT > ,
461+ T : GraphQLValue < S , Context = CtxT > ,
457462 {
458- match self . resolve ( info, value) {
459- Ok ( v) => v,
460- Err ( e) => {
461- self . push_error ( e) ;
462- Value :: null ( )
463- }
464- }
463+ self . resolve ( info, value) . unwrap_or_else ( |e| {
464+ self . push_error ( e) ;
465+ Value :: null ( )
466+ } )
465467 }
466468
467469 /// Resolve a single arbitrary value into a return value
468470 ///
469471 /// If the field fails to resolve, `null` will be returned.
470472 pub async fn resolve_into_value_async < T > ( & self , info : & T :: TypeInfo , value : & T ) -> Value < S >
471473 where
472- T : crate :: GraphQLTypeAsync < S , Context = CtxT > + Send + Sync + ?Sized ,
474+ T : GraphQLValueAsync < S , Context = CtxT > + Send + Sync + ?Sized ,
473475 T :: TypeInfo : Send + Sync ,
474476 CtxT : Send + Sync ,
475477 S : Send + Sync ,
@@ -851,9 +853,9 @@ pub async fn execute_validated_query_async<'a, 'b, QueryT, MutationT, Subscripti
851853) -> Result < ( Value < S > , Vec < ExecutionError < S > > ) , GraphQLError < ' a > >
852854where
853855 S : ScalarValue + Send + Sync ,
854- QueryT : crate :: GraphQLTypeAsync < S , Context = CtxT > + Send + Sync ,
856+ QueryT : GraphQLTypeAsync < S , Context = CtxT > + Send + Sync ,
855857 QueryT :: TypeInfo : Send + Sync ,
856- MutationT : crate :: GraphQLTypeAsync < S , Context = CtxT > + Send + Sync ,
858+ MutationT : GraphQLTypeAsync < S , Context = CtxT > + Send + Sync ,
857859 MutationT :: TypeInfo : Send + Sync ,
858860 SubscriptionT : GraphQLType < S , Context = CtxT > + Send + Sync ,
859861 SubscriptionT :: TypeInfo : Send + Sync ,
@@ -998,11 +1000,11 @@ where
9981000 ' d : ' r ,
9991001 ' op : ' d ,
10001002 S : ScalarValue + Send + Sync ,
1001- QueryT : crate :: GraphQLTypeAsync < S , Context = CtxT > + Send + Sync ,
1003+ QueryT : GraphQLTypeAsync < S , Context = CtxT > + Send + Sync ,
10021004 QueryT :: TypeInfo : Send + Sync ,
1003- MutationT : crate :: GraphQLTypeAsync < S , Context = CtxT > + Send + Sync ,
1005+ MutationT : GraphQLTypeAsync < S , Context = CtxT > + Send + Sync ,
10041006 MutationT :: TypeInfo : Send + Sync ,
1005- SubscriptionT : crate :: GraphQLSubscriptionType < S , Context = CtxT > + Send + Sync ,
1007+ SubscriptionT : GraphQLSubscriptionType < S , Context = CtxT > + Send + Sync ,
10061008 SubscriptionT :: TypeInfo : Send + Sync ,
10071009 CtxT : Send + Sync + ' r ,
10081010{
0 commit comments