Install & Compatibility
Where this runs
No compatibility data collected yet for this library.
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
Create and use a connection pool
use bb8::Pool;
use bb8::ManageConnection;
struct MyManager;
#[async_trait::async_trait]
impl ManageConnection for MyManager {
type Connection = String;
type Error = std::io::Error;
async fn connect(&self) -> Result<Self::Connection, Self::Error> {
Ok("connected".to_string())
}
async fn is_valid(&self, _conn: &mut Self::Connection) -> Result<(), Self::Error> {
Ok(())
}
fn has_broken(&self, _conn: &mut Self::Connection) -> bool {
false
}
}
#[tokio::main]
async fn main() {
let pool = Pool::builder().max_size(10).build(MyManager).await.unwrap();
let conn = pool.get().await.unwrap();
println!("{}", conn);
}
Audit
Dependencies
No dependency data recorded yet.