pub trait ModelRuntime: Send + Sync {
// Required methods
fn role(&self, table: &str) -> Option<ModelRole>;
fn write<'a>(
&'a self,
tx: &'a Transaction,
ast: QueryAst,
) -> TransactionFuture<'a, ModelWriteResult>;
// Provided methods
fn captures_table(&self, table: &str) -> bool { ... }
fn transaction_lock(&self) -> Option<Arc<Mutex<()>>> { ... }
fn prepare_read(&self, ast: QueryAst) -> QueryAst { ... }
fn authorize_read(&self, _ast: &QueryAst) -> Result<(), OrmError> { ... }
}Expand description
Transactional extension point for registered model writes. Implementations use raw transaction methods internally to avoid recursively capturing writes.
Required Methods§
fn role(&self, table: &str) -> Option<ModelRole>
fn write<'a>( &'a self, tx: &'a Transaction, ast: QueryAst, ) -> TransactionFuture<'a, ModelWriteResult>
Provided Methods§
Sourcefn captures_table(&self, table: &str) -> bool
fn captures_table(&self, table: &str) -> bool
Also intercept ordinary tables whose SQL referential actions affect tracked models.
fn transaction_lock(&self) -> Option<Arc<Mutex<()>>>
fn prepare_read(&self, ast: QueryAst) -> QueryAst
Recheck access for every SELECT, including nested subqueries, counts, relation loading, and SELECTs embedded in ordinary mutation predicates.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".