Expand description

Deadpool for SQLite 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 rusqlite and provides a wrapper that ensures correct use of the connection inside a separate thread.


FeatureDescriptionExtra dependenciesDefault
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/serde, serde/deriveno


use deadpool_sqlite::{Config, Runtime};

async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let mut cfg = Config::new("db.sqlite3");
    let pool = cfg.create_pool(Runtime::Tokio1).unwrap();
    let conn = pool.get().await.unwrap();
    let result: i64 = conn
        .interact(|conn| {
            let mut stmt = conn.prepare("SELECT 1")?;
            let mut rows = stmt.query([])?;
            let row = rows.next()?.unwrap();
    assert_eq!(result, 1);


Licensed under either of

at your option.


pub use rusqlite;


This macro creates all the type aliases usually reexported by deadpool-* crates. Crates that implement a deadpool manager should be considered stand alone crates and users of it should not need to use deadpool directly.


Configuration object.

Manager for creating and recycling SQLite Connections.

Statistics regarding an object returned by the 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 SyncWrapper::interact() fails.

Enumeration for picking a runtime implementation.

Type Definitions

This error is returned if there is something wrong with the SQLite configuration.

Type alias for Object

Type alias for using deadpool::managed::Hook with rusqlite.

Type alias for using deadpool::managed::Object with rusqlite.

Type alias for using deadpool::managed::Pool with rusqlite.