pub trait Driver:
Debug
+ Send
+ Sync
+ 'static {
// Required methods
fn url(&self) -> Cow<'_, str>;
fn capability(&self) -> &'static Capability;
fn connect<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Box<dyn Connection>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn generate_migration(&self, schema_diff: &SchemaDiff<'_>) -> Migration;
fn reset_db<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
// Provided method
fn max_connections(&self) -> Option<usize> { ... }
}Required Methods§
Sourcefn capability(&self) -> &'static Capability
fn capability(&self) -> &'static Capability
Describes the driver’s capability, which informs the query planner.
Sourcefn connect<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Box<dyn Connection>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn connect<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Box<dyn Connection>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Creates a new connection to the database.
This method is called by the [Pool] whenever a Connection is requested while none is
available and there is room to create a new Connection.
Sourcefn generate_migration(&self, schema_diff: &SchemaDiff<'_>) -> Migration
fn generate_migration(&self, schema_diff: &SchemaDiff<'_>) -> Migration
Generates a migration from a SchemaDiff.
Provided Methods§
Sourcefn max_connections(&self) -> Option<usize>
fn max_connections(&self) -> Option<usize>
Returns the maximum number of simultaneous database connections supported. For example,
this is Some(1) for the in-memory SQLite driver which cannot be pooled.