Driver

Trait Driver 

Source
pub trait Driver: Debug {
    type Connection: Connection;
    type SqlWriter: SqlWriter;
    type Prepared: Prepared;
    type Transaction<'c>: Transaction<'c>;

    const NAME: &'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<impl Connection>> { ... }
}
Expand description

Backend connector and SQL dialect provider.

Required Associated Constants§

Source

const NAME: &'static str

Human-readable backend name.

Required Associated Types§

Source

type Connection: Connection

Concrete connection.

Source

type SqlWriter: SqlWriter

SQL dialect writer.

Source

type Prepared: Prepared

Prepared statement handle.

Source

type Transaction<'c>: Transaction<'c>

Transaction type.

Required Methods§

Source

fn sql_writer(&self) -> Self::SqlWriter

Create a SQL writer.

Provided Methods§

Source

fn name(&self) -> &'static str

Driver name (used in URLs).

Source

fn connect( &self, url: Cow<'static, str>, ) -> impl Future<Output = Result<impl Connection>>

Connect to database url.

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.

Implementors§