Module salsa_2022::routes
source · [−]Structs
An ingredient index identifies a particular
Ingredient
in the database.
The database contains a number of jars, and each jar contains a number of ingredients.
Each ingredient is given a unique index as the database is being created.The “routes” structure is used to navigate the database.
The database contains a number of jars, and each jar contains a number of ingredients.
When the database is created, it creates each jar in turn.
Each jar then creates its ingredients.
Each ingredient is registered with the database by invoking the
Routes::push
method.
This method assigns it a unique IngredientIndex
and stores some callbacks indicating
how to find the ingredient later based only on the index.Type Definitions
Like a
DynRoute
, but for &mut
references.A “route” is a function that, given a
&DB::Jars
, returns an &dyn Ingredient
.
Routes are constructed (in part) from closures generated by the salsa macros.
These closures look essentially like |jar| &jar.some_field
– i.e., if a jar is a struct,
the closure returns a reference to some particular field of the struct
(whichever field has the database for this ingredient).