#[repr(transparent)]pub struct ArcBorrow<'a, T: ?Sized + 'a>(_);
Arc”. This is a pointer to
a T that is known to have been allocated within an
This is equivalent in guarantees to
&Arc<T>, however it is
a bit more flexible. To obtain an
&Arc<T> you must have
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
ArcBorrow lets us deal with borrows of known-refcounted objects
without needing to worry about where the
For constructing from a reference known to be Arc-backed, e.g. if we obtain such a reference over FFI TODO: should from_ref be relaxed to unsized types? It can’t be converted back to an Arc right now for unsized types.
ArcBorrows via pointer equality. Will only return
true if they come from the same allocation
Temporarily converts |self| into a bonafide Arc and exposes it to the provided callback. The refcount is not modified.
othervalues to be equal, and is used by