deadpool/managed/
reexports.rs

1//! This module contains all things that should be reexported
2//! by backend implementations in order to avoid direct dependencies
3//! on the `deadpool` crate itself.
4//!
5//! Crates based on `deadpool::managed` should include this line:
6//! ```rust,ignore
7//! pub use deadpool::managed::reexports::*;
8//! deadpool::managed_reexports!(
9//!     "name_of_crate",
10//!     Manager,
11//!     Object<Manager>,
12//!     Error,
13//!     ConfigError
14//! );
15//! ```
16
17pub use crate::{
18    managed::{Metrics, PoolConfig, Status, Timeouts},
19    Runtime,
20};
21
22/// This macro creates all the type aliases usually reexported by
23/// deadpool-* crates. Crates that implement a deadpool manager should
24/// be considered stand alone crates and users of it should not need
25/// to use `deadpool` directly.
26#[macro_export]
27macro_rules! managed_reexports {
28    ($crate_name:literal, $Manager:ty, $Wrapper:ty, $Error:ty, $ConfigError:ty) => {
29
30        #[doc=concat!("Type alias for using [`deadpool::managed::Pool`] with [`", $crate_name, "`].")]
31        pub type Pool = deadpool::managed::Pool<$Manager, $Wrapper>;
32
33        #[doc=concat!("Type alias for using [`deadpool::managed::PoolBuilder`] with [`", $crate_name, "`].")]
34        pub type PoolBuilder = deadpool::managed::PoolBuilder<$Manager, $Wrapper>;
35
36        #[doc=concat!("Type alias for using [`deadpool::managed::BuildError`] with [`", $crate_name, "`].")]
37        pub type BuildError = deadpool::managed::BuildError<$Error>;
38
39        #[doc=concat!("Type alias for using [`deadpool::managed::CreatePoolError`] with [`", $crate_name, "`].")]
40        pub type CreatePoolError = deadpool::managed::CreatePoolError<$ConfigError, $Error>;
41
42        #[doc=concat!("Type alias for using [`deadpool::managed::PoolError`] with [`", $crate_name, "`].")]
43        pub type PoolError = deadpool::managed::PoolError<$Error>;
44
45        #[doc=concat!("Type alias for using [`deadpool::managed::Object`] with [`", $crate_name, "`].")]
46        pub type Object = deadpool::managed::Object<$Manager>;
47
48        #[doc=concat!("Type alias for using [`deadpool::managed::Hook`] with [`", $crate_name, "`].")]
49        pub type Hook = deadpool::managed::Hook<$Manager>;
50
51        #[doc=concat!("Type alias for using [`deadpool::managed::HookError`] with [`", $crate_name, "`].")]
52        pub type HookError = deadpool::managed::HookError<$Error>;
53
54        #[doc=concat!("Type alias for using [`deadpool::managed::HookErrorCause`] with [`", $crate_name, "`].")]
55        pub type HookErrorCause = deadpool::managed::HookErrorCause<$Error>;
56
57    };
58}