1#[cfg(any(
2 feature = "util",
3 feature = "spawn-ready",
4 feature = "filter",
5 feature = "make"
6))]
7macro_rules! opaque_future {
8 ($(#[$m:meta])* pub type $name:ident<$($param:ident),+> = $actual:ty;) => {
9 pin_project_lite::pin_project! {
10 $(#[$m])*
11 pub struct $name<$($param),+> {
12 #[pin]
13 inner: $actual
14 }
15 }
16
17 impl<$($param),+> $name<$($param),+> {
18 pub(crate) fn new(inner: $actual) -> Self {
19 Self {
20 inner
21 }
22 }
23 }
24
25 impl<$($param),+> std::fmt::Debug for $name<$($param),+> {
26 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
27 f.debug_tuple(stringify!($name)).field(&format_args!("...")).finish()
28 }
29 }
30
31 impl<$($param),+> std::future::Future for $name<$($param),+>
32 where
33 $actual: std::future::Future,
34 {
35 type Output = <$actual as std::future::Future>::Output;
36 #[inline]
37 fn poll(self: std::pin::Pin<&mut Self>, cx: &mut std::task::Context<'_>) -> std::task::Poll<Self::Output> {
38 self.project().inner.poll(cx)
39 }
40 }
41 }
42}