pub trait Driver: Default + Debug {
type Connection: Connection<Driver = Self>;
type SqlWriter: SqlWriter;
type Prepared: Prepared;
type Transaction<'c>: Transaction<'c>;
const NAME: &'static [&'static str];
// Required method
fn sql_writer(&self) -> Self::SqlWriter;
// Provided methods
fn name(&self) -> &'static str { ... }
fn connect(
&self,
url: Cow<'static, str>,
) -> impl Future<Output = Result<Self::Connection>> { ... }
}Expand description
Backend connector and SQL dialect provider.
Required Associated Constants§
Required Associated Types§
Sourcetype Connection: Connection<Driver = Self>
type Connection: Connection<Driver = Self>
Concrete connection.
Sourcetype Transaction<'c>: Transaction<'c>
type Transaction<'c>: Transaction<'c>
Transaction type.
Required Methods§
Sourcefn sql_writer(&self) -> Self::SqlWriter
fn sql_writer(&self) -> Self::SqlWriter
Create a SQL writer.
Returns a writer capable of rendering SQL for this driver’s dialect. Writers are expected to be cheap to construct as they are usually stateless.
Provided Methods§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.