mirror of
https://github.com/salsa-rs/salsa.git
synced 2025-01-15 01:39:25 +00:00
add SalsaStructInDb impls for inputs, interned
Now all types have them.
This commit is contained in:
parent
25e085fbdc
commit
940ed006cf
2 changed files with 30 additions and 0 deletions
|
@ -37,6 +37,7 @@ impl InputStruct {
|
|||
let inherent_impl = self.input_inherent_impl();
|
||||
let ingredients_for_impl = self.input_ingredients(&config_structs);
|
||||
let as_id_impl = self.as_id_impl();
|
||||
let salsa_struct_in_db_impl = self.salsa_struct_in_db_impl();
|
||||
|
||||
Ok(quote! {
|
||||
#(#config_structs)*
|
||||
|
@ -45,6 +46,7 @@ impl InputStruct {
|
|||
#ingredients_for_impl
|
||||
#as_id_impl
|
||||
#(#config_impls)*
|
||||
#salsa_struct_in_db_impl
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -193,4 +195,17 @@ impl InputStruct {
|
|||
.map(|(_, i)| Literal::usize_unsuffixed(i))
|
||||
.collect()
|
||||
}
|
||||
|
||||
/// Implementation of `SalsaStructInDb`.
|
||||
fn salsa_struct_in_db_impl(&self) -> syn::ItemImpl {
|
||||
let ident = self.id_ident();
|
||||
let jar_ty = self.jar_ty();
|
||||
parse_quote! {
|
||||
impl<DB> salsa::salsa_struct::SalsaStructInDb<DB> for #ident
|
||||
where
|
||||
DB: ?Sized + salsa::DbWithJar<#jar_ty>,
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -38,6 +38,7 @@ impl InternedStruct {
|
|||
let ingredients_for_impl = self.ingredients_for_impl();
|
||||
let as_id_impl = self.as_id_impl();
|
||||
let named_fields_impl = self.inherent_impl_for_named_fields();
|
||||
let salsa_struct_in_db_impl = self.salsa_struct_in_db_impl();
|
||||
|
||||
Ok(quote! {
|
||||
#id_struct
|
||||
|
@ -45,6 +46,7 @@ impl InternedStruct {
|
|||
#ingredients_for_impl
|
||||
#as_id_impl
|
||||
#named_fields_impl
|
||||
#salsa_struct_in_db_impl
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -140,4 +142,17 @@ impl InternedStruct {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Implementation of `SalsaStructInDb`.
|
||||
fn salsa_struct_in_db_impl(&self) -> syn::ItemImpl {
|
||||
let ident = self.id_ident();
|
||||
let jar_ty = self.jar_ty();
|
||||
parse_quote! {
|
||||
impl<DB> salsa::salsa_struct::SalsaStructInDb<DB> for #ident
|
||||
where
|
||||
DB: ?Sized + salsa::DbWithJar<#jar_ty>,
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue