rename set method to specify

That's the method name we use when exposing this to users.
This commit is contained in:
Niko Matsakis 2022-08-07 23:52:43 -04:00
parent 9229b1a23a
commit ac837e2cdc
4 changed files with 8 additions and 5 deletions

View file

@ -416,7 +416,7 @@ fn specify_fn(
let (__jar, __runtime) = <_ as salsa::storage::HasJar<#jar_ty>>::jar(#db_var);
let __ingredients = <_ as salsa::storage::HasIngredientsFor<#config_ty>>::ingredient(__jar);
__ingredients.function.set(#db_var, #(#arg_names,)* #value_arg)
__ingredients.function.specify(#db_var, #(#arg_names,)* #value_arg)
}
},
}))

View file

@ -119,7 +119,7 @@ impl SalsaStruct {
let __ingredients = <#jar_ty as salsa::storage::HasIngredientsFor< #ident >>::ingredient(__jar);
let __id = __ingredients.#struct_index.new_struct(__runtime, (#(#id_field_names,)*));
#(
__ingredients.#value_field_indices.set(__db, __id, #value_field_names);
__ingredients.#value_field_indices.specify(__db, __id, #value_field_names);
)*
__id
}

View file

@ -22,7 +22,7 @@ mod inputs;
mod lru;
mod maybe_changed_after;
mod memo;
mod set;
mod specify;
mod store;
mod sync;
@ -33,7 +33,7 @@ mod sync;
///
/// * the `fetch` method, which is invoked when the function is called by the user's code;
/// it will return a memoized value if one exists, or execute the function otherwise.
/// * the `set` method, which can only be used when the key is an entity created by the active query.
/// * the `specify` method, which can only be used when the key is an entity created by the active query.
/// It sets the value of the function imperatively, so that when later fetches occur, they'll return this value.
/// * the `store` method, which can only be invoked with an `&mut` reference, and is to set input fields.
pub struct FunctionIngredient<C: Configuration> {

View file

@ -12,7 +12,10 @@ impl<C> FunctionIngredient<C>
where
C: Configuration,
{
pub fn set<'db>(&self, db: &'db DynDb<'db, C>, key: C::Key, value: C::Value)
/// Specifies the value of the function for the given key.
/// This is a way to imperatively set the value of a function.
/// It only works if the key is a tracked struct created in the current query.
pub fn specify<'db>(&self, db: &'db DynDb<'db, C>, key: C::Key, value: C::Value)
where
C::Key: TrackedStructInDb<DynDb<'db, C>>,
{