pub struct PotentialAtomic<T, W: PotentialWell>(/* private fields */);Expand description
Type-hoisted Atomic.
Uses PotentialWell to allow for recursive structures at the cost of some usability.
See the documentation for PotentialWell for more information.
Implementations§
Source§impl<T, W: PotentialWell> PotentialAtomic<T, W>
impl<T, W: PotentialWell> PotentialAtomic<T, W>
Sourcepub fn new(well: KineticWell<T, W>) -> PotentialAtomic<T, W>
pub fn new(well: KineticWell<T, W>) -> PotentialAtomic<T, W>
Creates atomic with a value.
Sourcepub unsafe fn as_raw_unchecked(&self) -> &AtomicPtr<T>
pub unsafe fn as_raw_unchecked(&self) -> &AtomicPtr<T>
Gives access to the underlying AtomicPtr.
§Safety
The pointer inside the atomic must always a valid pointer from Well::remove and
therefore must not be null. Additionally, keep in mind that this atomic owns the
pointer, and if you want to move it out, you must put a different pointer in its place
first.
Sourcepub fn swap(
&self,
well: KineticWell<T, W>,
ordering: Ordering,
) -> KineticWell<T, W>
pub fn swap( &self, well: KineticWell<T, W>, ordering: Ordering, ) -> KineticWell<T, W>
Atomically swaps the data inside the well.
This is equivalent to an atomic swap.
Source§impl<T, W: PotentialWell> PotentialAtomic<T, W>
impl<T, W: PotentialWell> PotentialAtomic<T, W>
Sourcepub fn load(&self, ordering: Ordering) -> &T
pub fn load(&self, ordering: Ordering) -> &T
Loads the inner data as an immutable reference.
This is equivalent to an atomic load.
Sourcepub fn swap_get(
&self,
well: KineticWell<T, W>,
ordering: Ordering,
) -> (KineticWell<T, W>, &T)
pub fn swap_get( &self, well: KineticWell<T, W>, ordering: Ordering, ) -> (KineticWell<T, W>, &T)
Atomically swaps the data inside the well and returns a reference to the new data.
This is swap, but with the unsafe deref hidden behind a safe API.
Source§impl<T: Unpin, W: PotentialWell> PotentialAtomic<T, W>
impl<T: Unpin, W: PotentialWell> PotentialAtomic<T, W>
Source§impl<T, W: PotentialWell> PotentialAtomic<T, Pin<W>>where
KineticWell<T, W>: StrongWellMut + Deref<Target = T>,
Pin<W>: PotentialWell<Well<T> = Pin<KineticWell<T, W>>>,
impl<T, W: PotentialWell> PotentialAtomic<T, Pin<W>>where
KineticWell<T, W>: StrongWellMut + Deref<Target = T>,
Pin<W>: PotentialWell<Well<T> = Pin<KineticWell<T, W>>>,
Sourcepub fn load_mut_pinned(&mut self) -> Pin<&mut T>
pub fn load_mut_pinned(&mut self) -> Pin<&mut T>
Loads the inner data as a mutable reference.
This is a version of load_mut that works with pinned values.
Source§impl<T, W: PotentialWell> PotentialAtomic<T, W>where
KineticWell<T, W>: Clone,
impl<T, W: PotentialWell> PotentialAtomic<T, W>where
KineticWell<T, W>: Clone,
Sourcepub fn load_clone(&self, ordering: Ordering) -> KineticWell<T, W>
pub fn load_clone(&self, ordering: Ordering) -> KineticWell<T, W>
Loads a clone of the inner data.
This still performs an atomic load, but instead of offering a reference, the smart
pointer is cloned instead.