use crate::refs::RefDef;
use core::mem;
use core::pin::Pin;
#[inline]
pub unsafe fn detach_lifetime_ref<'this, R: ?Sized>(v: R::Type<'_>) -> R::Type<'this>
where
R: RefDef,
{
let value = mem::transmute_copy(&v);
mem::forget(v);
return value;
}
#[inline]
pub unsafe fn detach_lifetime_get_ref<'this, R: ?Sized>(v: &'this R::Type<'_>) -> &'this R::Type<'this>
where
R: RefDef,
{
let value = mem::transmute_copy(&v);
mem::forget(v);
return value;
}
#[inline]
pub unsafe fn detach_lifetime_get_mut<'this, R: ?Sized>(v: &'this mut R::Type<'_>) -> &'this mut R::Type<'this>
where
R: RefDef,
{
let value = mem::transmute_copy(&v);
mem::forget(v);
return value;
}
#[inline]
pub unsafe fn detach_lifetime_pin_mut<'this, R: ?Sized>(
v: Pin<&mut R::Type<'_>>,
) -> Pin<&'this mut R::Type<'this>>
where
R: RefDef,
{
mem::transmute(v)
}
#[inline]
pub unsafe fn detach_lifetime_pin_ref<'this, R: ?Sized>(
v: Pin<&R::Type<'_>>,
) -> Pin<&'this R::Type<'this>>
where
R: RefDef,
{
mem::transmute(v)
}