fast_pool/
lib.rs

1#![allow(async_fn_in_trait)]
2
3#[macro_use]
4mod defer;
5pub mod duration;
6pub mod guard;
7pub mod plugin;
8pub mod pool;
9pub mod state;
10
11/// Trait for connection management and validation
12pub trait Manager: std::any::Any + Send + Sync {
13    type Connection: Send;
14
15    type Error: for<'a> From<&'a str>;
16
17    /// Create new connection
18    async fn connect(&self) -> Result<Self::Connection, Self::Error>;
19
20    /// Validate connection is alive (return Error if connection should be dropped)
21    async fn check(&self, conn: &mut Self::Connection) -> Result<(), Self::Error>;
22}
23
24pub use guard::ConnectionGuard;
25pub use pool::Pool;
26pub use state::State;