pub trait UnsafelyDetachBorrow<'a, 'b, T> {
unsafe fn unsafely_detach_borrow(&'a self) -> &'b T;
}
impl<'a, 'b, T> UnsafelyDetachBorrow<'a, 'b, T> for T {
unsafe fn unsafely_detach_borrow(&'a self) -> &'b T {
unsafe { core::mem::transmute::<&'a Self, &'b Self>(self) }
}
}
pub trait UnsafelyDetachBorrowMut<'a, 'b, T> {
unsafe fn unsafely_detach_borrow_mut(&'a mut self) -> &'b mut T;
}
impl<'a, 'b, T> UnsafelyDetachBorrowMut<'a, 'b, T> for T {
unsafe fn unsafely_detach_borrow_mut(&'a mut self) -> &'b mut T {
unsafe { core::mem::transmute::<&'a mut Self, &'b mut Self>(self) }
}
}