use crate::*;
use core::pin::Pin;
pub unsafe trait PinField<T>: Field<T> {
type PinWrapper<'a, U: ?Sized + 'a>;
}
impl<'a, T, F> Projectable<T, F> for Pin<&'a mut T>
where
F: PinField<T>,
F::Type: 'a,
{
type Target = F::PinWrapper<'a, F::Type>;
unsafe fn project(self) -> Self::Target {
let inner = unsafe { Self::into_inner_unchecked(self) };
let ptr = unsafe { &mut *F::map(inner as *mut _).cast_mut() };
unsafe { core::mem::transmute_copy(&ptr) }
}
}
#[doc(hidden)]
pub struct AlwaysUnpin<T>(T);
impl<T> Unpin for AlwaysUnpin<T> {}