1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
//! # EsoxSolutions.ObjectPool (Rust Port)
//!
//! High-performance, thread-safe object pool for Rust with async support,
//! metrics, health monitoring, and advanced features.
//!
//! ## Features
//!
//! - Thread-safe object pooling with lock-free operations
//! - Automatic return of objects via RAII ([`Drop`] trait)
//! - Async support with timeout and cancellation
//! - Queryable pools for finding objects matching predicates
//! - Dynamic pools with factory methods
//! - Health monitoring and metrics (including Prometheus export)
//! - Pool warm-up/pre-population
//! - Eviction/TTL support
//! - Circuit breaker pattern
//!
//! ## Quick Start
//!
//! ```rust
//! use esox_objectpool::ObjectPool;
//!
//! let pool = ObjectPool::new(vec![1, 2, 3], Default::default());
//! {
//! let obj = pool.get_object().unwrap();
//! println!("Got: {}", *obj);
//! // Object automatically returned when `obj` goes out of scope
//! }
//! ```
//!
//! ## Working with `PooledObject<T>`
//!
//! [`PooledObject<T>`](PooledObject) is a smart pointer that returns its contents to the
//! pool when dropped. It implements [`Deref`](std::ops::Deref) and
//! [`DerefMut`](std::ops::DerefMut) so it can be used transparently wherever `&T` or
//! `&mut T` are expected.
//!
//! Three explicit accessor methods are available:
//!
//! | Method | Returns | Pool effect |
//! |--------|---------|-------------|
//! | [`get()`](PooledObject::get) | `&T` | None — returned on drop |
//! | [`get_mut()`](PooledObject::get_mut) | `&mut T` | None — returned on drop |
//! | [`into_detached()`](PooledObject::into_detached) | `T` (owned) | **Permanently removed** |
//!
//! ```rust
//! use esox_objectpool::ObjectPool;
//!
//! let pool = ObjectPool::new(vec![0], Default::default());
//! let mut obj = pool.get_object().unwrap();
//!
//! *obj.get_mut() = 99; // mutate — stays in pool
//! assert_eq!(*obj.get(), 99); // borrow — stays in pool
//! drop(obj); // returned to pool as normal
//!
//! // Permanently take ownership (reduces pool capacity by 1):
//! let obj2 = pool.get_object().unwrap();
//! let value = obj2.into_detached();
//! assert_eq!(value, 99);
//! ```
//!
//! > **Note:** `unwrap()` on `PooledObject` is deprecated since 1.1.0.
//! > Use [`into_detached()`](PooledObject::into_detached) instead.
pub use ;
pub use PoolConfiguration;
pub use ;
pub use HealthStatus;
pub use EvictionPolicy;
pub use ;
pub use ;