Skip to main content

QueryExtensions

Trait QueryExtensions 

Source
pub trait QueryExtensions<Hook, Loader, MapperMod>: Query {
    // Provided methods
    fn hooks(&self) -> &[Hook] { ... }
    fn loaders(&self) -> &[Loader] { ... }
    fn mapper_mods(&self) -> &[MapperMod] { ... }
}
Expand description

The execution layer’s extension points, hung on the query rather than discovered by downcasting.

bob type-asserts a query against HookableQuery, Loadable and MapperModder at run time. Here the questions are trait methods, so they resolve statically: every one is defaulted to “none”, a Layer 1 query opts in with an empty impl, and a generated Layer 2 query overrides only what it actually carries.

The three payloads are type parameters because their concrete shapes depend on the executor, which core knows nothing about — while the trait itself has to live here, since neither a dialect crate nor a backend crate could implement the other’s trait for the other’s type. Core fixes the mechanism; the execution layer fills in the types.

Provided Methods§

Source

fn hooks(&self) -> &[Hook]

Hooks to run before this query executes.

Source

fn loaders(&self) -> &[Loader]

Loaders to run after this query executes, for eagerly loaded relations.

Source

fn mapper_mods(&self) -> &[MapperMod]

Adjustments to the row mapper, for relations loaded in the same query.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<D: Dialect, H, L, M> QueryExtensions<H, L, M> for RawQuery<D>