pub struct ArcBorrow<'a, T: ?Sized + 'a> { /* private fields */ }Expand description
A “borrowed Arc”. This is essentially a reference to an ArcInner<T>
This is equivalent in guarantees to &Arc<T>, however it has the same representation as an Arc<T>, minimizing pointer-chasing.
ArcBorrow lets us deal with borrows of known-refcounted objects
without needing to worry about where the Arc<T> is.
Implementations§
Source§impl<'a, T: ?Sized> ArcBorrow<'a, T>
impl<'a, T: ?Sized> ArcBorrow<'a, T>
Sourcepub fn ptr_eq(this: Self, other: Self) -> bool
pub fn ptr_eq(this: Self, other: Self) -> bool
Compare two ArcBorrows via pointer equality. Will only return
true if they come from the same allocation
Sourcepub fn get(&self) -> &'a T
pub fn get(&self) -> &'a T
Similar to deref, but uses the lifetime 'a rather than the lifetime of
self, which is incompatible with the signature of the Deref trait.
Sourcepub fn load_count(this: Self, order: Ordering) -> usize
pub fn load_count(this: Self, order: Ordering) -> usize
Gets the number of Arc pointers to this allocation, with a given load ordering
Trait Implementations§
Source§impl<'a, T: Ord> Ord for ArcBorrow<'a, T>
impl<'a, T: Ord> Ord for ArcBorrow<'a, T>
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl<'a, 'b, T, U: PartialOrd<T>> PartialOrd<ArcBorrow<'a, T>> for ArcBorrow<'b, U>
impl<'a, 'b, T, U: PartialOrd<T>> PartialOrd<ArcBorrow<'a, T>> for ArcBorrow<'b, U>
impl<'a, T: ?Sized> Copy for ArcBorrow<'a, T>
impl<'a, T: Eq> Eq for ArcBorrow<'a, T>
Auto Trait Implementations§
impl<'a, T> Freeze for ArcBorrow<'a, T>where
T: ?Sized,
impl<'a, T> RefUnwindSafe for ArcBorrow<'a, T>where
T: RefUnwindSafe + ?Sized,
impl<'a, T> !Send for ArcBorrow<'a, T>
impl<'a, T> !Sync for ArcBorrow<'a, T>
impl<'a, T> Unpin for ArcBorrow<'a, T>where
T: ?Sized,
impl<'a, T> UnwindSafe for ArcBorrow<'a, T>where
T: RefUnwindSafe + ?Sized,
Blanket Implementations§
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T, A> DynAccess<T> for A
impl<T, A> DynAccess<T> for A
Source§fn load(&self) -> DynGuard<T>
fn load(&self) -> DynGuard<T>
The equivalent of
Access::load.