#[repr(C)]pub struct AtomicArc<T, Alloc: IAlloc> { /* private fields */ }Expand description
An owner of an Arc<T, Alloc> whose pointee can be atomically changed.
Implementations§
Source§impl<T, Alloc: IAlloc> AtomicArc<T, Alloc>where
Struct<FieldPair<AtomicPtr<T>, PhantomData<*const Alloc>>>: IStable,
PhantomData<*const Alloc>: IStable,
AtomicPtr<T>: IStable,
impl<T, Alloc: IAlloc> AtomicArc<T, Alloc>where
Struct<FieldPair<AtomicPtr<T>, PhantomData<*const Alloc>>>: IStable,
PhantomData<*const Alloc>: IStable,
AtomicPtr<T>: IStable,
Sourcepub const fn has_optimal_layout() -> bool
pub const fn has_optimal_layout() -> bool
Returns true if the layout for AtomicArc is smaller or equal to that Rust would have generated for it.
Source§impl<T, Alloc: IAlloc> AtomicArc<T, Alloc>
impl<T, Alloc: IAlloc> AtomicArc<T, Alloc>
Sourcepub const fn new(value: Option<Arc<T, Alloc>>) -> Self
pub const fn new(value: Option<Arc<T, Alloc>>) -> Self
Constructs a new AtomicArc set to the provided value.
Sourcepub fn load(&self, order: Ordering) -> Option<Arc<T, Alloc>>
pub fn load(&self, order: Ordering) -> Option<Arc<T, Alloc>>
Atomically load the current value.
Sourcepub fn store(&self, value: Option<Arc<T, Alloc>>, order: Ordering)
pub fn store(&self, value: Option<Arc<T, Alloc>>, order: Ordering)
Atomically store a new value.
Sourcepub fn is(
&self,
current: Option<&Arc<T, Alloc>>,
order: Ordering,
) -> Result<(), Option<Arc<T, Alloc>>>
pub fn is( &self, current: Option<&Arc<T, Alloc>>, order: Ordering, ) -> Result<(), Option<Arc<T, Alloc>>>
Compares self with current by pointer.
§Errors
Returns the new value of self if it differs from current.
Sourcepub fn compare_exchange(
&self,
current: Option<&Arc<T, Alloc>>,
new: Option<Arc<T, Alloc>>,
success: Ordering,
failure: Ordering,
) -> Result<Option<Arc<T, Alloc>>, Option<Arc<T, Alloc>>>
pub fn compare_exchange( &self, current: Option<&Arc<T, Alloc>>, new: Option<Arc<T, Alloc>>, success: Ordering, failure: Ordering, ) -> Result<Option<Arc<T, Alloc>>, Option<Arc<T, Alloc>>>
Replace the current value with the new value.
§Errors
If current no longer points to the same value as self, it
Trait Implementations§
Source§impl<T, Alloc: IAlloc> IStable for AtomicArc<T, Alloc>where
Struct<FieldPair<AtomicPtr<T>, PhantomData<*const Alloc>>>: IStable,
PhantomData<*const Alloc>: IStable,
AtomicPtr<T>: IStable,
impl<T, Alloc: IAlloc> IStable for AtomicArc<T, Alloc>where
Struct<FieldPair<AtomicPtr<T>, PhantomData<*const Alloc>>>: IStable,
PhantomData<*const Alloc>: IStable,
AtomicPtr<T>: IStable,
Source§const REPORT: &'static TypeReport
const REPORT: &'static TypeReport
A compile-time generated report of the fields of the type, allowing for compatibility inspection.
Source§const ID: u64
const ID: u64
A stable (and ideally unique) identifier for the type. Often generated using
crate::report::gen_id, but can be manually set.Source§type ForbiddenValues = <Struct<FieldPair<AtomicPtr<T>, PhantomData<*const Alloc>>> as IStable>::ForbiddenValues
type ForbiddenValues = <Struct<FieldPair<AtomicPtr<T>, PhantomData<*const Alloc>>> as IStable>::ForbiddenValues
The values that the annotated type cannot occupy.
Source§type UnusedBits = <Struct<FieldPair<AtomicPtr<T>, PhantomData<*const Alloc>>> as IStable>::UnusedBits
type UnusedBits = <Struct<FieldPair<AtomicPtr<T>, PhantomData<*const Alloc>>> as IStable>::UnusedBits
The padding bits in the annotated types
Source§type Size = <Struct<FieldPair<AtomicPtr<T>, PhantomData<*const Alloc>>> as IStable>::Size
type Size = <Struct<FieldPair<AtomicPtr<T>, PhantomData<*const Alloc>>> as IStable>::Size
The size of the annotated type in bytes.
Source§type Align = <Struct<FieldPair<AtomicPtr<T>, PhantomData<*const Alloc>>> as IStable>::Align
type Align = <Struct<FieldPair<AtomicPtr<T>, PhantomData<*const Alloc>>> as IStable>::Align
The alignment of the annotated type in bytes.
Source§type HasExactlyOneNiche = <Struct<FieldPair<AtomicPtr<T>, PhantomData<*const Alloc>>> as IStable>::HasExactlyOneNiche
type HasExactlyOneNiche = <Struct<FieldPair<AtomicPtr<T>, PhantomData<*const Alloc>>> as IStable>::HasExactlyOneNiche
Allows the detection of whether or not
core::option::Options are stable: Read moreSource§type ContainsIndirections = <Struct<FieldPair<AtomicPtr<T>, PhantomData<*const Alloc>>> as IStable>::ContainsIndirections
type ContainsIndirections = <Struct<FieldPair<AtomicPtr<T>, PhantomData<*const Alloc>>> as IStable>::ContainsIndirections
Whether or not the type contains indirections (pointers, indices in independent data-structures…)
impl<T: Send + Sync, Alloc: IAlloc + Send + Sync> Send for AtomicArc<T, Alloc>
impl<T: Send + Sync, Alloc: IAlloc + Send + Sync> Sync for AtomicArc<T, Alloc>
Auto Trait Implementations§
impl<T, Alloc> !Freeze for AtomicArc<T, Alloc>
impl<T, Alloc> RefUnwindSafe for AtomicArc<T, Alloc>where
Alloc: RefUnwindSafe,
impl<T, Alloc> Unpin for AtomicArc<T, Alloc>
impl<T, Alloc> UnwindSafe for AtomicArc<T, Alloc>where
Alloc: RefUnwindSafe,
T: RefUnwindSafe,
Blanket Implementations§
Source§impl<Source> AccessAs for Source
impl<Source> AccessAs for Source
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more