rt 0.19.1

A real-time operating system capable of full preemption
Documentation
use core::cell::UnsafeCell;

// Just enough of SyncUnsafeCell to be usable while we wait for it to be stabilized.

#[repr(transparent)]
pub struct SyncUnsafeCell<T: ?Sized> {
    value: UnsafeCell<T>,
}

unsafe impl<T: ?Sized + Sync> Sync for SyncUnsafeCell<T> {}

impl<T> SyncUnsafeCell<T> {
    #[inline]
    pub const fn new(value: T) -> Self {
        Self {
            value: UnsafeCell::new(value),
        }
    }
}

impl<T: ?Sized> SyncUnsafeCell<T> {
    #[inline]
    pub const fn get(&self) -> *mut T {
        self.value.get()
    }

    #[inline]
    pub const fn raw_get(this: *const Self) -> *mut T {
        (this as *const T).cast_mut()
    }
}