Created
October 15, 2021 10:57
-
-
Save jplatte/aad789adff8a76200e720d3d46d1a2e0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Recursive expansion of pin_project! macro | |
// ========================================== | |
pub(crate)enum Either<A,B>{ | |
A { | |
inner:A | |
},B { | |
inner:B | |
} | |
} | |
#[allow(dead_code)] | |
#[allow(single_use_lifetimes)] | |
#[allow(clippy::unknown_clippy_lints)] | |
#[allow(clippy::mut_mut)] | |
#[allow(clippy::redundant_pub_crate)] | |
#[allow(clippy::ref_option_ref)] | |
#[allow(clippy::type_repetition_in_bounds)] | |
pub(crate)enum EitherProj< '__pin,A,B>where Either<A,B>: '__pin{ | |
A { | |
inner:$crate::__private::Pin<& '__pin mut(A)> | |
},B { | |
inner:$crate::__private::Pin<& '__pin mut(B)> | |
} | |
} | |
#[allow(single_use_lifetimes)] | |
#[allow(clippy::unknown_clippy_lints)] | |
#[allow(clippy::used_underscore_binding)] | |
const_:() = { | |
impl<A,B>Either<A,B>{ | |
pub(crate)fn project< '__pin>(self:$crate::__private::Pin<& '__pin mut Self>,) -> EitherProj< '__pin,A,B>{ | |
unsafe { | |
match self.get_unchecked_mut(){ | |
Self::A { | |
inner | |
} => { | |
EitherProj::A { | |
inner:$crate::__private::Pin::new_unchecked(inner) | |
} | |
}, | |
Self::B { | |
inner | |
} => { | |
EitherProj::B { | |
inner:$crate::__private::Pin::new_unchecked(inner) | |
} | |
} | |
} | |
} | |
} | |
} | |
#[allow(non_snake_case)] | |
pub(crate)struct __Origin< '__pin,A,B>{ | |
__dummy_lifetime:$crate::__private::PhantomData<& '__pin()>,A:(A),B:(B) | |
} | |
impl< '__pin,A,B>$crate::__private::Unpin for Either<A,B>where __Origin< '__pin,A,B>:$crate::__private::Unpin{} | |
trait MustNotImplDrop{} | |
#[allow(clippy::drop_bounds,drop_bounds)] | |
impl<T:$crate::__private::Drop>MustNotImplDrop for T{} | |
impl<A,B>MustNotImplDrop for Either<A,B>{} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment