mysql_connector/pool/
mod.rs1use std::{fmt, future::Future, pin::Pin};
2
3mod async_pool;
4mod pool_item;
5mod sync_pool;
6
7pub use {async_pool::*, pool_item::PoolItem, sync_pool::*};
8
9trait PoolPut<T> {
10 fn put(&self, value: T);
11}
12
13type AsyncPoolGetFuture<'a, T> =
14 dyn Future<Output = Result<PoolItem<'a, T>, <T as AsyncPoolContentError>::Error>> + 'a;
15
16pub trait AsyncPoolTrait<T: AsyncPoolContentError> {
17 fn get(&self) -> Pin<Box<AsyncPoolGetFuture<'_, T>>>;
18}
19
20pub trait AsyncPoolContent<T>: AsyncPoolContentError + Sized + 'static {
21 type Ctx: fmt::Debug;
22 fn new<'a>(ctx: &'a Self::Ctx)
23 -> Pin<Box<dyn Future<Output = Result<Self, Self::Error>> + 'a>>;
24}
25
26pub trait AsyncPoolContentError: 'static {
27 type Error: fmt::Debug;
28}