Skip to main content

Driver

Trait Driver 

Source
pub trait Driver:
    Send
    + Sync
    + 'static {
    // Required methods
    fn dialect(&self) -> Arc<dyn Dialect> ⓘ;
    fn connect(&self) -> BoxFuture<'_, Result<Box<dyn DriverConnection>>>;
    fn describe(&self) -> String;

    // Provided methods
    fn max_connections(&self) -> usize { ... }
    fn generation(&self) -> u64 { ... }
}
Expand description

Opens connections, and knows what dialect they speak.

Required Methods§

Source

fn dialect(&self) -> Arc<dyn Dialect> ⓘ

Source

fn connect(&self) -> BoxFuture<'_, Result<Box<dyn DriverConnection>>>

Source

fn describe(&self) -> String

How this connection is described in an error or a log line.

Must never contain the password — it ends up in messages people paste into issues.

Provided Methods§

Source

fn max_connections(&self) -> usize

How many connections the pool should allow at once.

Source

fn generation(&self) -> u64

Which generation of credentials a connection opened now would belong to.

Zero when the driver’s credentials never change, which is the common case and the one that costs nothing: the pool compares the number it stored against this, and zero always equals zero.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§