deadpool/
lib.rs

1#![doc = include_str!("../README.md")]
2#![cfg_attr(docsrs, feature(doc_cfg))]
3#![deny(
4    nonstandard_style,
5    rust_2018_idioms,
6    rustdoc::broken_intra_doc_links,
7    rustdoc::private_intra_doc_links
8)]
9#![forbid(non_ascii_idents, unsafe_code)]
10#![warn(
11    deprecated_in_future,
12    missing_copy_implementations,
13    missing_debug_implementations,
14    missing_docs,
15    unreachable_pub,
16    unused_import_braces,
17    unused_labels,
18    unused_lifetimes,
19    unused_qualifications,
20    unused_results
21)]
22#![allow(clippy::uninlined_format_args)]
23
24#[cfg(feature = "managed")]
25#[cfg_attr(docsrs, doc(cfg(feature = "managed")))]
26pub mod managed;
27
28#[cfg(feature = "unmanaged")]
29#[cfg_attr(docsrs, doc(cfg(feature = "unmanaged")))]
30pub mod unmanaged;
31
32pub use deadpool_runtime::{Runtime, SpawnBlockingError};
33
34/// The current pool status.
35///
36/// **The status returned by the pool is not guaranteed to be consistent!**
37///
38/// While this features provides [eventual consistency][1] the numbers will be
39/// off when accessing the status of a pool under heavy load. These numbers
40/// are meant for an overall insight.
41///
42/// [1]: (https://en.wikipedia.org/wiki/Eventual_consistency)
43#[derive(Clone, Copy, Debug)]
44pub struct Status {
45    /// The maximum size of the pool.
46    pub max_size: usize,
47
48    /// The current size of the pool.
49    pub size: usize,
50
51    /// The number of available objects in the pool.
52    pub available: usize,
53
54    /// The number of futures waiting for an object.
55    pub waiting: usize,
56}