diesel::r2d2

Trait R2D2Connection

Source
pub trait R2D2Connection: Connection {
    // Required method
    fn ping(&mut self) -> QueryResult<()>;

    // Provided method
    fn is_broken(&mut self) -> bool { ... }
}
Available on crate feature r2d2 only.
Expand description

A trait indicating a connection could be used inside a r2d2 pool

Required Methods§

Source

fn ping(&mut self) -> QueryResult<()>

Check if a connection is still valid

Provided Methods§

Source

fn is_broken(&mut self) -> bool

Checks if the connection is broken and should not be reused

This method should return only contain a fast non-blocking check if the connection is considered to be broken or not. See ManageConnection::has_broken for details.

The default implementation does not consider any connection as 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 R2D2Connection for MysqlConnection

Available on crate features mysql and mysql_backend only.
Source§

impl R2D2Connection for PgConnection

Available on crate features postgres and postgres_backend only.
Source§

impl R2D2Connection for SqliteConnection

Available on crate feature sqlite only.