[][src]Struct xarc::Xarc

pub struct Xarc<T: Send + Sync> { /* fields omitted */ }

Xarc is an atomic smart pointer.

Implementations

impl<T: Send + Sync> Xarc<T>[src]

pub fn new(value: T) -> Self[src]

Initialize the atomic smart pointer with value.

pub fn null() -> Self[src]

Initialize the atomic smart pointer with null.

pub fn compare_and_swap(
    &self,
    current: &XarcLocal<T>,
    new: &XarcLocal<T>,
    order: Ordering
) -> XarcLocal<T>
[src]

As an atomic operation, if self == current swap the contents of self with new. Returns the previous value of self. If the value does not equal current the operation failed.

pub fn compare_exchange(
    &self,
    current: &XarcLocal<T>,
    new: &XarcLocal<T>,
    success: Ordering,
    failure: Ordering
) -> Result<XarcLocal<T>, XarcLocal<T>>
[src]

As an atomic operation, if self == current swap the contents of self with new. Returns the previous value of self in a Result indicating whether the operation succeeded or failed.

pub fn compare_exchange_weak(
    &self,
    current: &XarcLocal<T>,
    new: &XarcLocal<T>,
    success: Ordering,
    failure: Ordering
) -> Result<XarcLocal<T>, XarcLocal<T>>
[src]

As an atomic operation, if self == current swap the contents of self with new. Returns the previous value of self in a Result indicating whether the operation succeeded or failed. Failure does not necessarily imply that self != current. This is typically called within a loop.

pub fn try_load(&self, order: Ordering) -> Result<XarcLocal<T>, ()>[src]

Attempt to load the value into an XarcLocal. It can fail if, after the pointer has been loaded but before it is used, it is swapped out in another thread and destroyed. If success is required, use XarcLocal::from instead.

Trait Implementations

impl<T: Debug + Send + Sync> Debug for Xarc<T>[src]

impl<T: Send + Sync> Default for Xarc<T>[src]

impl<T: Send + Sync> Drop for Xarc<T>[src]

impl<T: Send + Sync, '_> From<&'_ Xarc<T>> for XarcLocal<T>[src]

Auto Trait Implementations

impl<T> RefUnwindSafe for Xarc<T>

impl<T> Send for Xarc<T>

impl<T> Sync for Xarc<T>

impl<T> Unpin for Xarc<T>

impl<T> UnwindSafe for Xarc<T> where
    T: RefUnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.