[−][src]Struct triomphe::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 &Arc<T>
, however it is
a bit more flexible. To obtain an &Arc<T>
you must have
an Arc<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 OffsetArc
.
ArcBorrow
lets us deal with borrows of known-refcounted objects
without needing to worry about where the Arc<T>
is.
Implementations
impl<'a, T> ArcBorrow<'a, T>
[src]
pub fn clone_arc(&self) -> Arc<T>
[src]
Clone this as an Arc<T>
. This bumps the refcount.
pub unsafe fn from_ref(r: &'a T) -> Self
[src]
For constructing from a reference known to be Arc-backed, e.g. if we obtain such a reference over FFI
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 with_arc<F, U>(&self, f: F) -> U where
F: FnOnce(&Arc<T>) -> U,
T: 'static,
[src]
F: FnOnce(&Arc<T>) -> U,
T: 'static,
Temporarily converts |self| into a bonafide Arc and exposes it to the provided callback. The refcount is not modified.
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.
Trait Implementations
impl<'a, T> 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> Copy for ArcBorrow<'a, T>
[src]
impl<'a, T: Debug + 'a> Debug for ArcBorrow<'a, T>
[src]
impl<'a, T> Deref for ArcBorrow<'a, T>
[src]
impl<'a, T: Eq + 'a> Eq for ArcBorrow<'a, T>
[src]
impl<'a, T: PartialEq + '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: 'a> StructuralEq for ArcBorrow<'a, T>
[src]
impl<'a, T: 'a> StructuralPartialEq for ArcBorrow<'a, T>
[src]
Auto Trait Implementations
impl<'a, T> RefUnwindSafe for ArcBorrow<'a, T> where
T: RefUnwindSafe,
T: RefUnwindSafe,
impl<'a, T> Send for ArcBorrow<'a, T> where
T: Sync,
T: Sync,
impl<'a, T> Sync for ArcBorrow<'a, T> where
T: Sync,
T: Sync,
impl<'a, T> Unpin for ArcBorrow<'a, T>
impl<'a, T> 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,
pub 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> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub 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.
pub 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>,