File tree Expand file tree Collapse file tree 4 files changed +14
-5
lines changed Expand file tree Collapse file tree 4 files changed +14
-5
lines changed Original file line number Diff line number Diff line change @@ -26,9 +26,9 @@ mod field_execution {
26
26
graphql_object ! ( DeepDataType : ( ) |& self | {
27
27
field a( ) -> & str { "Already Been Done" }
28
28
field b( ) -> & str { "Boring" }
29
- field c( ) -> & [ Option <& str >] { & [ Some ( "Contrived" ) , None , Some ( "Confusing" ) ] }
29
+ field c( ) -> Vec < Option <& str >> { vec! [ Some ( "Contrived" ) , None , Some ( "Confusing" ) ] }
30
30
31
- field deeper( ) -> & [ Option <DataType >] { & [ Some ( DataType ) , None , Some ( DataType ) ] }
31
+ field deeper( ) -> Vec < Option <DataType >> { vec! [ Some ( DataType ) , None , Some ( DataType ) ] }
32
32
} ) ;
33
33
34
34
#[ test]
Original file line number Diff line number Diff line change @@ -69,13 +69,13 @@ macro_rules! __graphql__build_field_matches {
69
69
) => {
70
70
$(
71
71
if $fieldvar == & $crate:: to_snake_case( stringify!( $name) ) {
72
- let result: $t = {
72
+ let result: $t = ( || {
73
73
__graphql__args!(
74
74
@assign_arg_vars,
75
75
$argsvar, $executorvar, $( $args) *
76
76
) ;
77
77
$body
78
- } ;
78
+ } ) ( ) ;
79
79
80
80
return ( $crate:: IntoFieldResult :: into( result) ) . and_then( |r| $executorvar. resolve( & r) )
81
81
}
Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ use std::collections::HashMap;
3
3
use value:: Value ;
4
4
use ast:: InputValue ;
5
5
use schema:: model:: RootNode ;
6
+ use executor:: FieldResult ;
6
7
7
8
struct Interface ;
8
9
struct Root ;
@@ -14,6 +15,8 @@ Syntax to validate:
14
15
* Object vs. interface
15
16
* Description vs. no description
16
17
* Deprecated vs. not deprecated
18
+ * FieldResult vs. object directly
19
+ * Return vs. implicit return
17
20
18
21
*/
19
22
@@ -28,6 +31,12 @@ graphql_object!(Root: () |&self| {
28
31
field deprecated "Deprecation reason"
29
32
deprecated_descr( ) -> i64 as "Field description" { 0 }
30
33
34
+ field with_field_result( ) -> FieldResult <i64 > { Ok ( 0 ) }
35
+
36
+ field with_return( ) -> i64 { return 0 ; }
37
+
38
+ field with_return_field_result( ) -> FieldResult <i64 > { return Ok ( 0 ) ; }
39
+
31
40
interfaces: [ Interface ]
32
41
} ) ;
33
42
Original file line number Diff line number Diff line change @@ -84,7 +84,7 @@ graphql_object!(<'a> TypeType<'a>: SchemaType as "__Type" |&self| {
84
84
}
85
85
}
86
86
87
- field of_type( ) -> Option <& TypeType > {
87
+ field of_type( ) -> Option <& Box < TypeType > > {
88
88
match * self {
89
89
TypeType :: Concrete ( _) => None ,
90
90
TypeType :: List ( ref l) | TypeType :: NonNull ( ref l) => Some ( l) ,
You can’t perform that action at this time.
0 commit comments