[][src]Trait shared_data::SharedMemRef

pub unsafe trait SharedMemRef { }

A marker trait for types that it's safe to take a reference to in shared memory.

This is more restrictive than SharedMemoryCast, for example even though usize is SharedMemoryCast it's not safe to make a &usize pointing into shared memory, because if another process writes to that address, then that causes UB (the rust compiler is allowed to assume that the value pointed to by a &usize doesn't change during the references lifetime).

I don't think there's a safe mutable version of this, since it would then be possible to create &mut T which alias. For example if Box<AtomicUSize> implemented this, and an honest agent put two such boxes into shared memory, and an attacker overwrote the address of the second by the address of the first, then an honest agent could create two &mut AtomicUsize that alias, which is insta-UB.

SharedMemRef is to SharedMemCast as Sync is to Send.

Implementations on Foreign Types

impl SharedMemRef for AtomicBool[src]

impl SharedMemRef for AtomicUsize[src]

impl SharedMemRef for AtomicU64[src]

impl<T> SharedMemRef for AtomicPtr<T>[src]

impl SharedMemRef for ()[src]

impl<T1> SharedMemRef for (T1,) where
    T1: SharedMemRef
[src]

impl<T1, T2> SharedMemRef for (T1, T2) where
    T1: SharedMemRef,
    T2: SharedMemRef
[src]

impl<T1, T2, T3> SharedMemRef for (T1, T2, T3) where
    T1: SharedMemRef,
    T2: SharedMemRef,
    T3: SharedMemRef
[src]

Loading content...

Implementors

impl<T: SharedMemCast> SharedMemRef for SharedOption<T>[src]

impl<T: SharedMemCast> SharedMemRef for SharedRc<T>[src]

impl<T: SharedMemCast> SharedMemRef for SharedReceiver<T>[src]

impl<T: SharedMemCast> SharedMemRef for SharedSender<T>[src]

impl<T: SharedMemCast> SharedMemRef for SharedVec<T>[src]

impl<T: SharedMemCast> SharedMemRef for Volatile<T>[src]

Loading content...