Trait AsyncConnection

Source
pub trait AsyncConnection: AsyncExecute {
    // Required methods
    fn establish(
        database_url: &str,
    ) -> impl Future<Output = ConnectionResult<Self>> + Send;
    fn is_broken(&self) -> bool;
}
Expand description

An async connection to a database

This trait represents an async database connection.

Required Methods§

Source

fn establish( database_url: &str, ) -> impl Future<Output = ConnectionResult<Self>> + Send

Establishes a new connection to the database

The argument to this method and the method’s behavior varies by backend. See the documentation for that backend’s connection class for details about what it accepts and how it behaves.

Source

fn is_broken(&self) -> bool

Checks if the connection is broken

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§

Source§

impl AsyncConnection for AsyncMysqlConnection

Available on crate feature mysql only.
Source§

impl AsyncConnection for AsyncPgConnection

Available on crate feature postgres only.
Source§

impl AsyncConnection for TestConnection