1use core::cell::UnsafeCell;
2pub use mincache_impl::*;
3
4#[repr(transparent)]
7pub struct SyncUnsafeCell<T>(UnsafeCell<T>);
8impl<T> SyncUnsafeCell<T> {
9 #[inline(always)]
10 pub const fn new(val: T) -> Self {
11 Self(UnsafeCell::new(val))
12 }
13
14 #[inline(always)]
15 pub fn get_mut(&self) -> &mut T {
16 unsafe { &mut *self.0.get() }
17 }
18}
19unsafe impl<T> Sync for SyncUnsafeCell<T> {}
20impl<T> core::ops::Deref for SyncUnsafeCell<T> {
21 type Target = T;
22
23 #[inline(always)]
24 fn deref(&self) -> &Self::Target {
25 unsafe { &*self.0.get() }
26 }
27}