mirror of
https://github.com/tokio-rs/axum.git
synced 2026-08-26 00:00:23 +02:00
Use pin-project-lite instead of pin-project (#95)
This commit is contained in:
+7
-5
@@ -9,10 +9,12 @@ macro_rules! opaque_future {
|
||||
};
|
||||
|
||||
($(#[$m:meta])* pub type $name:ident<$($param:ident),*> = $actual:ty;) => {
|
||||
#[pin_project::pin_project]
|
||||
$(#[$m])*
|
||||
pub struct $name<$($param),*>(#[pin] pub(crate) $actual)
|
||||
where;
|
||||
pin_project_lite::pin_project! {
|
||||
$(#[$m])*
|
||||
pub struct $name<$($param),*> {
|
||||
#[pin] pub(crate) future: $actual,
|
||||
}
|
||||
}
|
||||
|
||||
impl<$($param),*> std::fmt::Debug for $name<$($param),*> {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
@@ -27,7 +29,7 @@ macro_rules! opaque_future {
|
||||
type Output = <$actual as std::future::Future>::Output;
|
||||
#[inline]
|
||||
fn poll(self: std::pin::Pin<&mut Self>, cx: &mut std::task::Context<'_>) -> std::task::Poll<Self::Output> {
|
||||
self.project().0.poll(cx)
|
||||
self.project().future.poll(cx)
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user