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 token_bucket;
14pub(crate) mod ts;
15pub(crate) mod tunnel_activity;
16
17use futures::Sink;
18use std::pin::Pin;
19use std::task::{Context, Poll};
20
21pub(crate) trait SinkExt<T>: Sink<T> {
23 fn poll_ready_unpin_bool(&mut self, cx: &mut Context<'_>) -> Result<bool, Self::Error>
29 where
30 Self: Unpin,
31 {
32 Ok(match Sink::poll_ready(Pin::new(self), cx) {
33 Poll::Ready(Ok(())) => true,
34 Poll::Ready(Err(e)) => return Err(e),
35 Poll::Pending => false,
36 })
37 }
38}
39impl<T, S: Sink<T>> SinkExt<T> for S {}
40
41#[cfg(any(test, feature = "testing"))]
46pub(crate) fn fake_mq<A: crate::memquota::SpecificAccount>() -> A {
47 A::new_noop()
48}
49
50#[cfg(test)]
54pub(crate) struct DummyTimeoutEstimator;
55
56#[cfg(test)]
57impl crate::client::circuit::TimeoutEstimator for DummyTimeoutEstimator {
58 fn circuit_build_timeout(&self, _length: usize) -> std::time::Duration {
59 std::time::Duration::from_millis(1000)
61 }
62}