Trait diesel::r2d2::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§


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

Check if a connection is still valid

Provided Methods§


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

Object Safety§

This trait is not object safe.



impl R2D2Connection for MysqlConnection

Available on crate features mysql and mysql_backend only.

impl R2D2Connection for PgConnection

Available on crate features postgres and postgres_backend only.

impl R2D2Connection for SqliteConnection

Available on crate feature sqlite only.