@@ -105,22 +105,21 @@ graphql_object!(CommasOnMeta: () |&self| {
105
105
} ) ;
106
106
107
107
struct InnerContext ;
108
- const INNER_CONTEXT : InnerContext = InnerContext ;
109
108
impl Context for InnerContext { }
110
109
111
110
struct InnerType ;
112
111
graphql_object ! ( InnerType : InnerContext |& self | {
113
112
} ) ;
114
113
115
114
struct CtxSwitcher ;
116
- graphql_object ! ( CtxSwitcher : ( ) |& self | {
117
- field ctx_switch_always( ) -> ( & InnerContext , InnerType ) { ( & INNER_CONTEXT , InnerType ) }
118
- field ctx_switch_opt( ) -> Option <( & InnerContext , InnerType ) > { Some ( ( & INNER_CONTEXT , InnerType ) ) }
119
- field ctx_switch_res( ) -> FieldResult <( & InnerContext , InnerType ) > { Ok ( ( & INNER_CONTEXT , InnerType ) ) }
120
- field ctx_switch_res_opt( ) -> FieldResult <Option <( & InnerContext , InnerType ) >> { Ok ( Some ( ( & INNER_CONTEXT , InnerType ) ) ) }
115
+ graphql_object ! ( CtxSwitcher : InnerContext |& self | {
116
+ field ctx_switch_always( & executor ) -> ( & InnerContext , InnerType ) { ( executor . context ( ) , InnerType ) }
117
+ field ctx_switch_opt( & executor ) -> Option <( & InnerContext , InnerType ) > { Some ( ( executor . context ( ) , InnerType ) ) }
118
+ field ctx_switch_res( & executor ) -> FieldResult <( & InnerContext , InnerType ) > { Ok ( ( executor . context ( ) , InnerType ) ) }
119
+ field ctx_switch_res_opt( & executor ) -> FieldResult <Option <( & InnerContext , InnerType ) >> { Ok ( Some ( ( executor . context ( ) , InnerType ) ) ) }
121
120
} ) ;
122
121
123
- graphql_object ! ( <' a> Root : ( ) as "Root" |& self | {
122
+ graphql_object ! ( <' a> Root : InnerContext as "Root" |& self | {
124
123
field custom_name( ) -> CustomName { CustomName { } }
125
124
126
125
field with_lifetime( ) -> WithLifetime <' a> { WithLifetime { data: PhantomData } }
@@ -164,13 +163,13 @@ where
164
163
}
165
164
}
166
165
"# ;
167
- let schema = RootNode :: new ( Root { } , EmptyMutation :: < ( ) > :: new ( ) ) ;
166
+ let schema = RootNode :: new ( Root { } , EmptyMutation :: < InnerContext > :: new ( ) ) ;
168
167
let vars = vec ! [
169
168
( "typeName" . to_owned( ) , InputValue :: string( type_name) ) ,
170
169
] . into_iter ( )
171
170
. collect ( ) ;
172
171
173
- let ( result, errs) = :: execute ( doc, None , & schema, & vars, & ( ) ) . expect ( "Execution failed" ) ;
172
+ let ( result, errs) = :: execute ( doc, None , & schema, & vars, & InnerContext ) . expect ( "Execution failed" ) ;
174
173
175
174
assert_eq ! ( errs, [ ] ) ;
176
175
0 commit comments