Type Definition salsa_2022::routes::DynRoute

source · []
pub type DynRoute<DB: HasJars> = dyn Fn(&DB::Jars) -> &dyn Ingredient<DB> + Send + Sync;
Expand description

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).

The key point here is: the struct definitions that are being referencd here come from crates that consume this crate, and hence we cannot name them directly. We have to navigate them through closures generated by that downstream crate.