diff --git a/src/client/client.rs b/src/client/client.rs index 15723e48..80fb9525 100644 --- a/src/client/client.rs +++ b/src/client/client.rs @@ -1,7 +1,7 @@ /// A marker to identify what version a pooled connection is. #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)] #[allow(dead_code)] -pub(super) enum Ver { +pub enum Ver { Auto, Http2, } diff --git a/src/client/pool.rs b/src/client/pool.rs index 6ea29e5d..4f8e93ba 100644 --- a/src/client/pool.rs +++ b/src/client/pool.rs @@ -24,7 +24,7 @@ use crate::common::{exec::Exec, ready}; // FIXME: allow() required due to `impl Trait` leaking types to this lint #[allow(missing_debug_implementations)] -pub(super) struct Pool { +pub struct Pool { // If the pool is disabled, this is None. inner: Option>>>, } @@ -34,7 +34,7 @@ pub(super) struct Pool { // This is a trait to allow the `client::pool::tests` to work for `i32`. // // See https://github.com/hyperium/hyper/issues/1429 -pub(super) trait Poolable: Unpin + Send + Sized + 'static { +pub trait Poolable: Unpin + Send + Sized + 'static { fn is_open(&self) -> bool; /// Reserve this connection. /// @@ -54,7 +54,7 @@ impl Key for T where T: Eq + Hash + Clone + Debug + Unpin + Send + 'static {} /// used for multiple requests. // FIXME: allow() required due to `impl Trait` leaking types to this lint #[allow(missing_debug_implementations)] -pub(super) enum Reservation { +pub enum Reservation { /// This connection could be used multiple times, the first one will be /// reinserted into the `idle` pool, and the second will be given to /// the `Checkout`. @@ -66,7 +66,7 @@ pub(super) enum Reservation { } /// Simple type alias in case the key type needs to be adjusted. -// pub(super) type Key = (http::uri::Scheme, http::uri::Authority); //Arc; +// pub type Key = (http::uri::Scheme, http::uri::Authority); //Arc; struct PoolInner { // A flag that a connection is being established, and the connection @@ -101,19 +101,19 @@ struct PoolInner { struct WeakOpt(Option>); #[derive(Clone, Copy, Debug)] -pub(super) struct Config { - pub(super) idle_timeout: Option, - pub(super) max_idle_per_host: usize, +pub struct Config { + pub idle_timeout: Option, + pub max_idle_per_host: usize, } impl Config { - pub(super) fn is_enabled(&self) -> bool { + pub fn is_enabled(&self) -> bool { self.max_idle_per_host > 0 } } impl Pool { - pub(super) fn new(config: Config, __exec: &Exec) -> Pool { + pub fn new(config: Config, __exec: &Exec) -> Pool { let inner = if config.is_enabled() { Some(Arc::new(Mutex::new(PoolInner { connecting: HashSet::new(), @@ -153,7 +153,7 @@ impl Pool { impl Pool { /// Returns a `Checkout` which is a future that resolves if an idle /// connection becomes available. - pub(super) fn checkout(&self, key: K) -> Checkout { + pub fn checkout(&self, key: K) -> Checkout { Checkout { key, pool: self.clone(), @@ -163,7 +163,7 @@ impl Pool { /// Ensure that there is only ever 1 connecting task for HTTP/2 /// connections. This does nothing for HTTP/1. - pub(super) fn connecting(&self, key: &K, ver: Ver) -> Option> { + pub fn connecting(&self, key: &K, ver: Ver) -> Option> { if ver == Ver::Http2 { if let Some(ref enabled) = self.inner { let mut inner = enabled.lock().unwrap(); @@ -213,7 +213,7 @@ impl Pool { } */ - pub(super) fn pooled( + pub fn pooled( &self, #[cfg_attr(not(feature = "http2"), allow(unused_mut))] mut connecting: Connecting, value: T, @@ -496,7 +496,7 @@ impl Clone for Pool { /// A wrapped poolable value that tries to reinsert to the Pool on Drop. // Note: The bounds `T: Poolable` is needed for the Drop impl. -pub(super) struct Pooled { +pub struct Pooled { value: Option, is_reused: bool, key: K, @@ -504,11 +504,11 @@ pub(super) struct Pooled { } impl Pooled { - pub(super) fn is_reused(&self) -> bool { + pub fn is_reused(&self) -> bool { self.is_reused } - pub(super) fn is_pool_enabled(&self) -> bool { + pub fn is_pool_enabled(&self) -> bool { self.pool.0.is_some() } @@ -569,14 +569,14 @@ struct Idle { // FIXME: allow() required due to `impl Trait` leaking types to this lint #[allow(missing_debug_implementations)] -pub(super) struct Checkout { +pub struct Checkout { key: K, pool: Pool, waiter: Option>, } #[derive(Debug)] -pub(super) struct CheckoutIsClosedError; +pub struct CheckoutIsClosedError; impl Error for CheckoutIsClosedError {} @@ -696,13 +696,13 @@ impl Drop for Checkout { // FIXME: allow() required due to `impl Trait` leaking types to this lint #[allow(missing_debug_implementations)] -pub(super) struct Connecting { +pub struct Connecting { key: K, pool: WeakOpt>>, } impl Connecting { - pub(super) fn alpn_h2(self, pool: &Pool) -> Option { + pub fn alpn_h2(self, pool: &Pool) -> Option { debug_assert!( self.pool.0.is_none(), "Connecting::alpn_h2 but already Http2" diff --git a/src/common/mod.rs b/src/common/mod.rs index f6ea6f4e..a28e9296 100644 --- a/src/common/mod.rs +++ b/src/common/mod.rs @@ -10,7 +10,7 @@ macro_rules! ready { } pub(crate) use ready; -pub(crate) mod exec; +pub mod exec; pub(crate) mod never; #[cfg(feature = "runtime")]