Expand description

This module contains the unmanaged version of the pool. Unmanaged meaning that no manager is used to create and recycle objects. Objects either need to be created upfront or by adding them using the add or try_add methods.

Example

use deadpool::unmanaged::Pool;

struct Computer {}

impl Computer {
    async fn get_answer(&self) -> i32 {
        42
    }
}

#[tokio::main]
async fn main() {
    let pool = Pool::from(vec![
        Computer {},
        Computer {},
    ]);
    let s = pool.get().await.unwrap();
    assert_eq!(s.get_answer().await, 42);
}

Re-exports

pub use crate::Status;

Structs

A wrapper around the actual pooled object which implements the traits Deref, DerefMut and Drop. Use this object just as if it was of type T and upon leaving scope the drop function will take care of returning it to the pool.

A generic object and connection pool. This is the static version of the pool which does not include

Pool configuration

Enums

Error structure for Pool::get