Crate deadpool_diesel[][src]

Expand description

Deadpool for Diesel Latest Version Unsafe forbidden Rust 1.54+

Deadpool is a dead simple async pool for connections and objects of any type.

This crate implements a deadpool manager for diesel connections.


FeatureDescriptionExtra dependenciesDefault
sqliteEnable sqlite feature in diesel cratediesel/sqliteno
postgresEnable postgres feature in diesel cratediesel/postgresno
mysqlEnable mysql feature in diesel cratediesel/mysqlno
rt_tokio_1Enable support for tokio cratedeadpool/rt_tokio_1yes
rt_async-std_1Enable support for async-std cratedeadpool/rt_async-std_1no
serdeEnable support for serde cratedeadpool/serdeno


use deadpool_diesel::sqlite::{Runtime, Manager, Pool};
use diesel::{prelude::*, select, sql_types::Text};

async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let manager = Manager::new(":memory:", Runtime::Tokio1);
    let pool = Pool::builder(manager)
    let conn = pool.get().await?;
    let result = conn.interact(|conn| {
        let query = select("Hello world!".into_sql::<Text>());
    assert!(result == "Hello world!");


Licensed under either of

at your option.



Type aliases for using deadpool-diesel with MySQL.


Type aliases for using deadpool-diesel with PostgreSQL.


Type aliases for using deadpool-diesel with SQLite.


Statistics regarding an object returned by the pool

Generic object and connection pool.

Pool configuration.

The current pool status.

This guard is returned when calling SyncWrapper::lock or SyncWrapper::try_lock. This is basicly just a wrapper around a MutexGuard but hides some implementation details.

Timeouts when getting Objects from a Pool.


Possible errors returned when managing Connections.

Possible errors returned when SyncWrapper::interact() fails.

Enumeration for picking a runtime implementation.

Type Definitions

Connection which is returned by the Pool.

Type alias for using deadpool::managed::PoolError with diesel.