pub(crate) mod ct;
pub(crate) mod err;
pub(crate) mod keyed_futures_unordered;
pub(crate) mod notify;
pub(crate) mod oneshot_broadcast;
pub(crate) mod poll_all;
pub(crate) mod sink_blocker;
pub(crate) mod skew;
pub(crate) mod sometimes_unbounded_sink;
pub(crate) mod stream_poll_set;
pub(crate) mod timeout;
pub(crate) mod token_bucket;
pub(crate) mod ts;
pub(crate) mod tunnel_activity;
use futures::Sink;
use std::pin::Pin;
use std::task::{Context, Poll};
pub(crate) trait SinkExt<T>: Sink<T> {
fn poll_ready_unpin_bool(&mut self, cx: &mut Context<'_>) -> Result<bool, Self::Error>
where
Self: Unpin,
{
Ok(match Sink::poll_ready(Pin::new(self), cx) {
Poll::Ready(Ok(())) => true,
Poll::Ready(Err(e)) => return Err(e),
Poll::Pending => false,
})
}
}
impl<T, S: Sink<T>> SinkExt<T> for S {}
#[cfg(any(test, feature = "testing"))]
pub(crate) fn fake_mq<A: crate::memquota::SpecificAccount>() -> A {
A::new_noop()
}
#[cfg(test)]
pub(crate) struct DummyTimeoutEstimator;
#[cfg(test)]
impl crate::client::circuit::TimeoutEstimator for DummyTimeoutEstimator {
fn circuit_build_timeout(&self, _length: usize) -> std::time::Duration {
std::time::Duration::from_millis(1000)
}
}