From ec141aceba6fb84ad578bf45ab1a86a00d27d3a3 Mon Sep 17 00:00:00 2001 From: Mihail Mihov Date: Thu, 11 Aug 2022 20:26:53 +0300 Subject: [PATCH] Replace inputs' FunctionIngredients with InputFieldIngredients --- components/salsa-2022-macros/src/input.rs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/components/salsa-2022-macros/src/input.rs b/components/salsa-2022-macros/src/input.rs index 75e9c1eb..7dc40092 100644 --- a/components/salsa-2022-macros/src/input.rs +++ b/components/salsa-2022-macros/src/input.rs @@ -35,7 +35,7 @@ impl InputStruct { let id_struct = self.id_struct(); let inherent_impl = self.input_inherent_impl(); - let ingredients_for_impl = self.input_ingredients(&config_structs); + let ingredients_for_impl = self.input_ingredients(); let as_id_impl = self.as_id_impl(); let salsa_struct_in_db_impl = self.salsa_struct_in_db_impl(); @@ -74,7 +74,7 @@ impl InputStruct { { let (__jar, __runtime) = <_ as salsa::storage::HasJar<#jar_ty>>::jar(__db); let __ingredients = <#jar_ty as salsa::storage::HasIngredientsFor< #ident >>::ingredient(__jar); - __ingredients.#field_index.fetch(__db, self) + __ingredients.#field_index.fetch(self) } } } else { @@ -83,7 +83,7 @@ impl InputStruct { { let (__jar, __runtime) = <_ as salsa::storage::HasJar<#jar_ty>>::jar(__db); let __ingredients = <#jar_ty as salsa::storage::HasIngredientsFor< #ident >>::ingredient(__jar); - __ingredients.#field_index.fetch(__db, self).clone() + __ingredients.#field_index.fetch(self).clone() } } } @@ -127,19 +127,19 @@ impl InputStruct { /// /// The entity's ingredients include both the main entity ingredient along with a /// function ingredient for each of the value fields. - fn input_ingredients(&self, config_structs: &[syn::ItemStruct]) -> syn::ItemImpl { + fn input_ingredients(&self) -> syn::ItemImpl { let ident = self.id_ident(); + let field_ty = self.all_field_tys(); let jar_ty = self.jar_ty(); let all_field_indices: Vec = self.all_field_indices(); let input_index: Literal = self.input_index(); - let config_struct_names = config_structs.iter().map(|s| &s.ident); parse_quote! { impl salsa::storage::IngredientsFor for #ident { type Jar = #jar_ty; type Ingredients = ( #( - salsa::function::FunctionIngredient<#config_struct_names>, + salsa::input_field::InputFieldIngredient<#ident, #field_ty>, )* salsa::input::InputIngredient<#ident>, ); @@ -160,7 +160,7 @@ impl InputStruct { &ingredients.#all_field_indices }, ); - salsa::function::FunctionIngredient::new(index) + salsa::input_field::InputFieldIngredient::new(index) }, )* {