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