Skip to main content

bind_executor

Macro bind_executor 

Source
macro_rules! bind_executor {
    ($executor:ty) => { ... };
}
Expand description

Writes the Connection impl for a concrete Rainier ORM Executor.

ⓘ
struct MyExecutor { /* … */ }
impl rainier_orm::Executor for MyExecutor { /* … */ }

rainier_database::bind_executor!(MyExecutor);

Two constraints, both worth knowing before you reach for this:

  1. The type must be concrete. Rust cannot prove a generic E: Executor has Send futures — that needs return-type notation, still unstable — whereas for a named type the auto traits leak out of the async fn bodies and the compiler works it out.
  2. The type must be yours. Connection is defined here, so the orphan rule allows the impl only in this crate or in the crate defining the executor. An application therefore cannot bind an executor it did not write; the ones Rainier ORM ships are bound below, behind the same feature flags Rainier ORM uses for them.