@@ -35,7 +35,7 @@ pub enum FieldPath<'a> {
35
35
/// The executor helps drive the query execution in a schema. It keeps track
36
36
/// of the current field stack, context, variables, and errors.
37
37
pub struct Executor < ' a , CtxT > where CtxT : ' a {
38
- fragments : & ' a HashMap < String , Fragment > ,
38
+ fragments : & ' a HashMap < & ' a str , & ' a Fragment > ,
39
39
variables : & ' a HashMap < String , InputValue > ,
40
40
current_selection_set : Option < Vec < Selection > > ,
41
41
schema : & ' a SchemaType ,
@@ -232,7 +232,7 @@ impl<'a, CtxT> Executor<'a, CtxT> {
232
232
233
233
#[ doc( hidden) ]
234
234
pub fn fragment_by_name ( & self , name : & str ) -> Option < & ' a Fragment > {
235
- self . fragments . get ( name)
235
+ self . fragments . get ( name) . map ( |f| * f )
236
236
}
237
237
238
238
/// Add an error to the execution engine
@@ -337,7 +337,7 @@ pub fn execute_validated_query<'a, QueryT, MutationT, CtxT>(
337
337
338
338
{
339
339
let executor = Executor {
340
- fragments : & fragments. into_iter ( ) . map ( |f| ( f. item . name . item . clone ( ) , f. item ) ) . collect ( ) ,
340
+ fragments : & fragments. iter ( ) . map ( |f| ( f. item . name . item . as_str ( ) , & f. item ) ) . collect ( ) ,
341
341
variables : variables,
342
342
current_selection_set : Some ( op. item . selection_set ) ,
343
343
schema : & root_node. schema ,
0 commit comments