Skip to main content

pool

Function pool 

Source
pub fn pool() -> Result<&'static AnyPool, AppError>
Expand description

Returns the pool every #[derive(Model)] method and QueryBuilder call resolves its connection through - this single resolution point (not a parameter threaded through every generated method) is what makes with_pool_override below work at all. Checks the task-local override first (set only inside larust_testing::test_transaction), then falls back to the process-wide pool. Errors (rather than panics) if neither is set - a misconfigured startup order is a real possibility (e.g. a route handler running before main finishes wiring up the database), not a truly unreachable state.