# mobc **Repository Path**: rustpro/mobc ## Basic Information - **Project Name**: mobc - **Description**: No description available - **Primary Language**: Unknown - **License**: Apache-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2022-01-08 - **Last Updated**: 2024-06-23 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # mobc A generic connection pool with async/await support. Inspired by r2d2 and Golang SQL package.
[Documentation](https://docs.rs/mobc/latest/mobc/) [Changelog](https://github.com/importcjj/mobc/blob/master/CHANGELOG.md) **Note: mobc requires at least Rust 1.39.** ## Usage ```toml [dependencies] mobc = "0.7" # For async-std runtime # mobc = { version = "0.7", features = ["async-std"] } # For actix-rt 1.0 # mobc = { version = "0.7", features = ["actix-rt"] } ``` ## Features * Support async/.await syntax * Support both `tokio` and `async-std` * High performance * Easy to customize * Dynamic configuration ## Adaptors | Backend | Adaptor Crate | | ----------------------------------------------------------- | ----------------------------------------------------------- | | [tokio-postgres](https://github.com/sfackler/rust-postgres) | [mobc-postgres](https://github.com/importcjj/mobc-postgres) | | [redis](https://github.com/mitsuhiko/redis-rs) | [mobc-redis](https://github.com/importcjj/mobc-redis) | | [arangodb](https://github.com/fMeow/arangors) | [mobc-arangors](https://github.com/inzanez/mobc-arangors) | | [lapin](https://github.com/CleverCloud/lapin) | [mobc-lapin](https://github.com/zupzup/mobc-lapin) | | [reql](https://github.com/rethinkdb/rethinkdb-rs) | [mobc-reql](https://github.com/rethinkdb/rethinkdb-rs) | | [redis-cluster](https://docs.rs/redis_cluster_async/0.6.0/redis_cluster_async/index.html) | [mobc-redis-cluster](https://github.com/rogeriob2br/mobc-redis-cluster)| More DB adaptors are welcome. ## Examples More [examples](https://github.com/importcjj/mobc/tree/master/mobc-foo/examples) Using an imaginary "foodb" database. ```rust use mobc::{async_trait, Manager}; #[derive(Debug)] pub struct FooError; pub struct FooConnection; impl FooConnection { pub async fn query(&self) -> String { "PONG".to_string() } } pub struct FooManager; #[async_trait] impl Manager for FooManager { type Connection = FooConnection; type Error = FooError; async fn connect(&self) -> Result