[−][src]Struct triomphe::OffsetArc
An Arc
, except it holds a pointer to the T instead of to the
entire ArcInner. This struct is FFI-compatible.
Arc<T> OffsetArc<T>
| |
v v
---------------------
| RefCount | T (data) | [ArcInner<T>]
---------------------
This means that this is a direct pointer to
its contained data (and can be read from by both C++ and Rust),
but we can also convert it to a "regular" Arc
This is very useful if you have an Arc-containing struct shared between Rust and C++,
and wish for C++ to be able to read the data behind the Arc
without incurring
an FFI call overhead.
Implementations
impl<T> OffsetArc<T>
[src]
pub fn with_arc<F, U>(&self, f: F) -> U where
F: FnOnce(&Arc<T>) -> U,
[src]
F: FnOnce(&Arc<T>) -> U,
Temporarily converts |self| into a bonafide Arc and exposes it to the provided callback. The refcount is not modified.
pub fn make_mut(&mut self) -> &mut T where
T: Clone,
[src]
T: Clone,
If uniquely owned, provide a mutable reference Else create a copy, and mutate that
This is functionally the same thing as Arc::make_mut
pub fn clone_arc(&self) -> Arc<T>
[src]
Clone it as an Arc
pub fn borrow_arc<'a>(&'a self) -> ArcBorrow<'a, T>
[src]
Produce a pointer to the data that can be converted back
to an Arc
Trait Implementations
impl<T> Clone for OffsetArc<T>
[src]
fn clone(&self) -> Self
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<T: Debug> Debug for OffsetArc<T>
[src]
impl<T> Deref for OffsetArc<T>
[src]
impl<T> Drop for OffsetArc<T>
[src]
impl<T: Eq> Eq for OffsetArc<T>
[src]
impl<T: PartialEq> PartialEq<OffsetArc<T>> for OffsetArc<T>
[src]
impl<T: Sync + Send> Send for OffsetArc<T>
[src]
impl<T> StructuralEq for OffsetArc<T>
[src]
impl<T: Sync + Send> Sync for OffsetArc<T>
[src]
Auto Trait Implementations
impl<T> RefUnwindSafe for OffsetArc<T> where
T: RefUnwindSafe,
T: RefUnwindSafe,
impl<T> Unpin for OffsetArc<T> where
T: Unpin,
T: Unpin,
impl<T> UnwindSafe for OffsetArc<T> where
T: RefUnwindSafe + UnwindSafe,
T: RefUnwindSafe + UnwindSafe,
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>,