CompareExchange

Trait CompareExchange 

Source
pub trait CompareExchange<T, N> {
    // Required method
    fn compare_exchange<C: Into<NonNull<T>>>(
        &self,
        current: Option<C>,
        new: Option<N>,
    ) -> Result<(), Option<Guard<'static, T>>>;
}
Expand description

A trait for implementations of compare_exchange on AtomicArc.

If self and current point to the same object, new’s pointer will be stored into self and the result will be an empty Ok. Otherwise, a load occurs, and an Err containing a Guard will be returned.

Required Methods§

Source

fn compare_exchange<C: Into<NonNull<T>>>( &self, current: Option<C>, new: Option<N>, ) -> Result<(), Option<Guard<'static, T>>>

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<T: 'static> CompareExchange<T, &Arc<T>> for AtomicArc<T>

Source§

impl<T: 'static> CompareExchange<T, &Guard<'static, T>> for AtomicArc<T>