Trait salsa_2022::function::Configuration
source · [−]pub trait Configuration {
type Jar: for<'db> Jar<'db>;
type SalsaStruct: for<'db> SalsaStructInDb<DynDb<'db, Self>>;
type Key: AsId;
type Value: Debug;
const CYCLE_STRATEGY: CycleRecoveryStrategy;
fn should_backdate_value(
old_value: &Self::Value,
new_value: &Self::Value
) -> bool;
fn execute(db: &DynDb<'_, Self>, key: Self::Key) -> Self::Value;
fn recover_from_cycle(
db: &DynDb<'_, Self>,
cycle: &Cycle,
key: Self::Key
) -> Self::Value;
fn key_from_id(id: Id) -> Self::Key { ... }
}
Required Associated Types
type Jar: for<'db> Jar<'db>
sourcetype SalsaStruct: for<'db> SalsaStructInDb<DynDb<'db, Self>>
type SalsaStruct: for<'db> SalsaStructInDb<DynDb<'db, Self>>
The “salsa struct type” that this function is associated with.
This can be just salsa::Id
for functions that intern their arguments
and are not clearly associated with any one salsa struct.
Required Associated Constants
sourceconst CYCLE_STRATEGY: CycleRecoveryStrategy
const CYCLE_STRATEGY: CycleRecoveryStrategy
Determines whether this function can recover from being a participant in a cycle (and, if so, how).
Required Methods
sourcefn should_backdate_value(
old_value: &Self::Value,
new_value: &Self::Value
) -> bool
fn should_backdate_value(
old_value: &Self::Value,
new_value: &Self::Value
) -> bool
Invokes after a new result new_value`` has been computed for which an older memoized value existed
old_value`. Returns true if the new value is equal to the older one
and hence should be “backdated” (i.e., marked as having last changed in an older revision,
even though it was recomputed).
This invokes user’s code in form of the Eq
impl.
Provided Methods
sourcefn key_from_id(id: Id) -> Self::Key
fn key_from_id(id: Id) -> Self::Key
Given a salsa Id, returns the key. Convenience function to avoid
having to type <C::Key as AsId>::from_id
.