pub trait AtomicLoadStore: Sized {
    type Content: AtomicData<AtomicWrapper = Self>;

    fn new(v: Self::Content) -> Self;
    fn relaxed_load(&self) -> Self::Content;
    fn relaxed_store(&self, val: Self::Content);
}
Expand description

Atomic wrapper type for a certain kind of value

For the implementation of RaceCell not to be considered as undefined behaviour and trashed by the Rust compiler in release mode, the underlying type must be loaded and stored atomically. This requires synchronizing accesses to it using things like the std::sync::atomic::AtomicXyz wrappers.

The only guarantee that we need is that loads and stores are atomic. We do not need any other memory ordering guarantee. This is why we allow for more wrapper type implementation freedom by not specifying memory orderings, and internally relying only on relaxed ordering.

Required Associated Types

Type of data that is being wrapped

Required Methods

Create an atomic wrapper for a value of type U

Atomically load a value from the wrapper

Atomically store a new value into the wrapper

Implementations on Foreign Types

Implementors