use core::cell::UnsafeCell; #[repr(transparent)] pub struct SyncUnsafe(UnsafeCell); unsafe impl Sync for SyncUnsafe {} impl SyncUnsafe { pub const fn new(val: T) -> Self { Self(UnsafeCell::new(val)) } pub const fn get(&self) -> *mut T { self.0.get() } #[allow(clippy::mut_from_ref, clippy::missing_safety_doc)] pub unsafe fn as_mut_unchecked(&self) -> &mut T { unsafe { &mut *self.0.get() } } #[allow(clippy::missing_safety_doc)] pub unsafe fn as_ref_unchecked(&self) -> &T { unsafe { &*self.0.get() } } }