diff options
| author | Per Lindgren <per.lindgren@ltu.se> | 2021-11-02 19:47:14 +0100 |
|---|---|---|
| committer | Per Lindgren <per.lindgren@ltu.se> | 2021-11-02 19:47:14 +0100 |
| commit | 1e2ab78a3fad8f383e5949dd0a11aaaaf03467f1 (patch) | |
| tree | d19541cbcda4316cf6a9b0eba5f9429f830cd2fb /src | |
| parent | 8065d741aceb96ea06e70afce05408e334a977b5 (diff) | |
added doc for RacyCell
Diffstat (limited to 'src')
| -rw-r--r-- | src/lib.rs | 21 |
1 files changed, 21 insertions, 0 deletions
@@ -59,6 +59,27 @@ where use core::cell::UnsafeCell; /// Internal replacement for `static mut T` +/// +/// Used to represent RTIC Resources +/// +/// Soundness: +/// 1) Unsafe API for internal use only +/// 2) get_mut(&self) -> *mut T +/// returns a raw mutable pointer to the inner T +/// casting to &mut T is under control of RTIC +/// RTIC ensures &mut T to be unique under Rust aliasing rules. +/// +/// Implementation uses the underlying UnsafeCell<T> +/// self.0.get() -> *mut T +/// +/// 3) get(&self) -> *const T +/// returns a raw immutable (const) pointer to the inner T +/// casting to &T is under control of RTIC +/// RTIC ensures &T to be shared under Rust aliasing rules. +/// +/// Implementation uses the underlying UnsafeCell<T> +/// self.0.get() -> *mut T, demoted to *const T +/// #[repr(transparent)] pub struct RacyCell<T>(UnsafeCell<T>); |
