Available on crate feature
unmanaged only.Expand description
Unmanaged version of the pool.
“Unmanaged” means that no manager is used to create and recycle objects.
Objects either need to be created upfront or by adding them using the
Pool::add() or Pool::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§
- Object
- Wrapper around the actual pooled object which implements
Deref,DerefMutandDroptraits. - Pool
- Generic object and connection pool. This is the static version of the pool which doesn’t include.
- Pool
Config - Pool configuration.
Enums§
- Pool
Error - Possible errors of
Pool::get()operation.