Crates.io | ljprs_async_pool |
lib.rs | ljprs_async_pool |
version | 1.0.0 |
source | src |
created_at | 2023-03-27 05:27:23.333305 |
updated_at | 2023-03-27 05:27:23.333305 |
description | Provides an async-friendly pool data structure using tokio. |
homepage | https://github.com/lukejoshuapark/ljprs_async_pool |
repository | https://github.com/lukejoshuapark/ljprs_async_pool |
max_upload_size | |
id | 821762 |
size | 12,289 |
Provides an async-friendly pool data structure using tokio.
use std::io;
use ljprs_async_pool::AsyncPool;
async fn initializer_fn() -> Result<i32, io::Error> {
Ok(42)
}
let pool = AsyncPool::new(16, initializer_fn);
let guard = pool.get().await;
assert!(guard.is_ok());
assert_eq!(*(guard.unwrap()), 42);