pub trait BuildMod<Q>:
Debug
+ Send
+ Sync {
// Required method
fn apply(&self, q: &mut Q) -> Result<()>;
}Expand description
A mod that runs when the query is built rather than when it is assembled.
bob calls these contextual mods. They exist for what cannot be decided at
assembly time — a WHERE that depends on the schema in use, say — and they
run on every build, so a query keeps them as Vec<Arc<dyn BuildMod<Q>>> and
applies them to a clone of itself at the top of write_sql.
&self rather than self, because unlike a Mod they are applied more than
once. Unlike rendering they can fail, and they run before there is any SQL to
attach a failure to, so this one returns a Result; the caller records it on
the writer.
Required Methods§
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".