1pub(crate) mod ct;
4pub(crate) mod err;
5pub(crate) mod keyed_futures_unordered;
6pub(crate) mod notify;
7pub(crate) mod oneshot_broadcast;
8pub(crate) mod poll_all;
9pub(crate) mod sink_blocker;
10pub(crate) mod skew;
11pub(crate) mod sometimes_unbounded_sink;
12pub(crate) mod stream_poll_set;
13pub(crate) mod timeout;
14pub(crate) mod token_bucket;
15pub(crate) mod ts;
16pub(crate) mod tunnel_activity;
17
18use futures::Sink;
19use std::pin::Pin;
20use std::task::{Context, Poll};
21
22pub(crate) trait SinkExt<T>: Sink<T> {
24 fn poll_ready_unpin_bool(&mut self, cx: &mut Context<'_>) -> Result<bool, Self::Error>
30 where
31 Self: Unpin,
32 {
33 Ok(match Sink::poll_ready(Pin::new(self), cx) {
34 Poll::Ready(Ok(())) => true,
35 Poll::Ready(Err(e)) => return Err(e),
36 Poll::Pending => false,
37 })
38 }
39}
40impl<T, S: Sink<T>> SinkExt<T> for S {}
41
42#[cfg(any(test, feature = "testing"))]
47pub(crate) fn fake_mq<A: crate::memquota::SpecificAccount>() -> A {
48 A::new_noop()
49}
50
51#[cfg(test)]
55pub(crate) struct DummyTimeoutEstimator;
56
57#[cfg(test)]
58impl crate::client::circuit::TimeoutEstimator for DummyTimeoutEstimator {
59 fn circuit_build_timeout(&self, _length: usize) -> std::time::Duration {
60 std::time::Duration::from_millis(1000)
62 }
63}