pub trait Configurable: Pool {
type Options: Send;
// Required method
fn init_with<'life0, 'async_trait, F>(
figment: &'life0 Figment,
f: F,
) -> Pin<Box<dyn Future<Output = Result<Self, Self::Error>> + Send + 'async_trait>>
where F: FnOnce(&Config, Self::Options) -> Result<Self::Options, Self::Error> + Send + 'async_trait,
Self: 'async_trait,
'life0: 'async_trait;
}Expand description
A Pool that supports customization during initialization.
This trait enables Database::custom() and
Database::try_custom(). It is implemented
for SQLx pools and MongoDB clients.
Required Associated Types§
Sourcetype Options: Send
type Options: Send
The driver’s configuration options.
The configuration types for the supported drivers are:
- SQLx:
(sqlx::pool::PoolOptions<D>, ConnectOptions), whereDisSqlite,Postgres, orMySql, andConnectOptionsisSqliteConnectOptions,PgConnectOptions, orMySqlConnectOptions, respectively. - MongoDB:
mongodb::options::ClientOptions.
Required Methods§
Sourcefn init_with<'life0, 'async_trait, F>(
figment: &'life0 Figment,
f: F,
) -> Pin<Box<dyn Future<Output = Result<Self, Self::Error>> + Send + 'async_trait>>
fn init_with<'life0, 'async_trait, F>( figment: &'life0 Figment, f: F, ) -> Pin<Box<dyn Future<Output = Result<Self, Self::Error>> + Send + 'async_trait>>
Constructs a pool from figment, customizing its options with f.
Implementations should extract Config from figment and apply its
values and the driver’s defaults to Self::Options. The function f
is then called with the configuration and options. The returned options
are used to create the pool.
Implementations should share this initialization path with
Pool::init(). Any error returned by f is returned to the caller.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".