[−][src]Struct elysees::ArcBorrow
A "borrowed Arc
". This is a pointer to
a T that is known to have been allocated within an
Arc
.
This is equivalent in guarantees to &ArcHandle<T>
, however it is
a bit more flexible. To obtain an &ArcHandle<T>
you must have
an ArcHandle<T>
instance somewhere pinned down until we're done with it.
It's also a direct pointer to T
, so using this involves less pointer-chasing
However, C++ code may hand us refcounted things as pointers to T directly,
so we have to conjure up a temporary Arc
on the stack each time. The
same happens for when the object is managed by a Arc
.
ArcBorrow
lets us deal with borrows of known-refcounted objects
without needing to worry about where the Arc<T>
is.
Implementations
impl<'a, T: ?Sized> ArcBorrow<'a, T>
[src]
pub fn clone_arc(&self) -> Arc<T>
[src]
Clone this as an Arc<T>
. This bumps the refcount.
pub fn as_arc(&self) -> &Arc<T>
[src]
Borrow this as an Arc<T>
. This does not bump the refcount.
pub unsafe fn from_ref(ptr: &'a T) -> Self
[src]
For constructing from a pointer known to be Arc-backed, e.g. if we obtain such a pointer over FFI
Safety
This pointer shouild come from Arc::into_raw
: this, however, will not consume it!
pub unsafe fn from_raw(ptr: *const T) -> Self
[src]
For constructing from a pointer known to be Arc-backed, e.g. if we obtain such a pointer over FFI
Safety
This pointer shouild come from Arc::into_raw
: this, however, will not consume it!
pub fn into_raw(this: Self) -> *const T
[src]
Get the internal pointer of an ArcBorrow
pub fn ptr_eq(this: Self, other: Self) -> bool
[src]
Compare two ArcBorrow
s via pointer equality. Will only return
true if they come from the same allocation
pub fn get(&self) -> &'a T
[src]
Similar to deref, but uses the lifetime |a| rather than the lifetime of self, which is incompatible with the signature of the Deref trait.
pub fn count(this: ArcBorrow<'a, T>, ordering: Ordering) -> usize
[src]
Get the reference count of this Arc
with a given memory ordering
Trait Implementations
impl<'a, T: ?Sized> AsRef<&'a T> for ArcBorrow<'a, T>
[src]
impl<'a, T: ?Sized> AsRef<*const T> for ArcBorrow<'a, T>
[src]
impl<'a, T: ?Sized> AsRef<*mut T> for ArcBorrow<'a, T>
[src]
impl<'a, T: ?Sized> AsRef<Arc<T>> for ArcBorrow<'a, T>
[src]
impl<'a, T: ?Sized> AsRef<NonNull<T>> for ArcBorrow<'a, T>
[src]
impl<'a, T: ?Sized> AsRef<T> for ArcBorrow<'a, T>
[src]
impl<'a, T: ?Sized> Borrow<&'a T> for ArcBorrow<'a, T>
[src]
impl<'a, T: ?Sized> Borrow<Arc<T>> for ArcBorrow<'a, T>
[src]
impl<'a, T: ?Sized> Borrow<T> for ArcBorrow<'a, T>
[src]
impl<'a, T: ?Sized> Clone for ArcBorrow<'a, T>
[src]
fn clone(&self) -> Self
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<'a, T: ?Sized> CloneStableDeref for ArcBorrow<'a, T>
[src]
impl<'a, T: ?Sized> Copy for ArcBorrow<'a, T>
[src]
impl<'a, T: Debug + ?Sized + 'a> Debug for ArcBorrow<'a, T>
[src]
impl<'a, T: ?Sized> Deref for ArcBorrow<'a, T>
[src]
impl<'a, T: Eq + ?Sized + 'a> Eq for ArcBorrow<'a, T>
[src]
impl<'a, T: ?Sized + Erasable> ErasablePtr for ArcBorrow<'a, T>
[src]
impl<'a, T: Hash + ?Sized + 'a> Hash for ArcBorrow<'a, T>
[src]
fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl<'a, T: Ord + ?Sized + 'a> Ord for ArcBorrow<'a, T>
[src]
fn cmp(&self, other: &ArcBorrow<'a, T>) -> Ordering
[src]
#[must_use]fn max(self, other: Self) -> Self
1.21.0[src]
#[must_use]fn min(self, other: Self) -> Self
1.21.0[src]
#[must_use]fn clamp(self, min: Self, max: Self) -> Self
[src]
impl<'a, T: PartialEq + ?Sized + 'a> PartialEq<ArcBorrow<'a, T>> for ArcBorrow<'a, T>
[src]
fn eq(&self, other: &ArcBorrow<'a, T>) -> bool
[src]
fn ne(&self, other: &ArcBorrow<'a, T>) -> bool
[src]
impl<'a, T: PartialOrd + ?Sized + 'a> PartialOrd<ArcBorrow<'a, T>> for ArcBorrow<'a, T>
[src]
fn partial_cmp(&self, other: &ArcBorrow<'a, T>) -> Option<Ordering>
[src]
fn lt(&self, other: &ArcBorrow<'a, T>) -> bool
[src]
fn le(&self, other: &ArcBorrow<'a, T>) -> bool
[src]
fn gt(&self, other: &ArcBorrow<'a, T>) -> bool
[src]
fn ge(&self, other: &ArcBorrow<'a, T>) -> bool
[src]
impl<'a, T: ?Sized + Serialize> Serialize for ArcBorrow<'a, T>
[src]
impl<'a, T: ?Sized> StableDeref for ArcBorrow<'a, T>
[src]
impl<'a, T: ?Sized + 'a> StructuralEq for ArcBorrow<'a, T>
[src]
impl<'a, T: ?Sized + 'a> StructuralPartialEq for ArcBorrow<'a, T>
[src]
impl<'a, T: ?Sized> UnionAlign for ArcBorrow<'a, T> where
ArcBorrow<'a, T>: ErasablePtr,
[src]
ArcBorrow<'a, T>: ErasablePtr,
fn left<B: UnionAlign>(this: Self) -> Union2<Self, B>
[src]
fn right<A: UnionAlign>(this: Self) -> Union2<A, Self>
[src]
fn a<B: UnionAlign, C: UnionAlign, D: UnionAlign>(
this: Self
) -> Union4<Self, B, C, D>
[src]
this: Self
) -> Union4<Self, B, C, D>
fn b<A: UnionAlign, C: UnionAlign, D: UnionAlign>(
this: Self
) -> Union4<A, Self, C, D>
[src]
this: Self
) -> Union4<A, Self, C, D>
fn c<A: UnionAlign, B: UnionAlign, D: UnionAlign>(
this: Self
) -> Union4<A, B, Self, D>
[src]
this: Self
) -> Union4<A, B, Self, D>
fn d<A: UnionAlign, B: UnionAlign, C: UnionAlign>(
this: Self
) -> Union4<A, B, C, Self>
[src]
this: Self
) -> Union4<A, B, C, Self>
Auto Trait Implementations
impl<'a, T: ?Sized> RefUnwindSafe for ArcBorrow<'a, T> where
T: RefUnwindSafe,
T: RefUnwindSafe,
impl<'a, T> !Send for ArcBorrow<'a, T>
impl<'a, T> !Sync for ArcBorrow<'a, T>
impl<'a, T: ?Sized> Unpin for ArcBorrow<'a, T>
impl<'a, T: ?Sized> UnwindSafe for ArcBorrow<'a, 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> Erasable for T
[src]
unsafe fn unerase(this: NonNull<Erased>) -> NonNull<T>
[src]
const ACK_1_1_0: bool
[src]
fn erase(this: NonNull<Self>) -> NonNull<Erased>
[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> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
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>,