[−][src]Struct xarc::Xarc
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]
&self,
current: &XarcLocal<T>,
new: &XarcLocal<T>,
order: Ordering
) -> XarcLocal<T>
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]
&self,
current: &XarcLocal<T>,
new: &XarcLocal<T>,
success: Ordering,
failure: Ordering
) -> Result<XarcLocal<T>, XarcLocal<T>>
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]
&self,
current: &XarcLocal<T>,
new: &XarcLocal<T>,
success: Ordering,
failure: Ordering
) -> Result<XarcLocal<T>, XarcLocal<T>>
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,
T: RefUnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,