Struct OffsetArc Copy item path Source pub struct OffsetArc<T: ?Sized > { }Expand description An Arc, except it holds a pointer to the T instead of to the
entire ArcInner.
An OffsetArc<T> has the same layout and ABI as a non-null
const T* in C, and may be used in FFI function signatures.
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<T> by removing the offset.
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.
If uniquely owned, provide a mutable reference
Else create a copy, and mutate that
This is functionally the same thing as Arc::make_mut
Temporarily converts |self| into a bonafide Arc and exposes it to the
provided callback. The refcount is not modified.
Produce a pointer to the data that can be converted back
to an Arc
The reference count of this Arc.
The number does not include borrowed pointers,
or temporary Arc pointers created with functions like
ArcBorrow::with_arc .
The function is called strong_count to mirror std::sync::Arc::strong_count,
however triomphe::Arc does not support weak references.
Performs copy-assignment from
source.
Read more Formats the value using the given formatter.
Read more The resulting type after dereferencing.
Dereferences the value.
Executes the destructor for this type.
Read more 🔬 This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to
Drop::drop, it requires
self
to be pinned.
Read more Converts to this type from the input type.
Converts to this type from the input type.
Compares and returns the maximum of two values.
Read more Compares and returns the minimum of two values.
Read more Restrict a value to a certain interval.
Read more Tests for self and other values to be equal, and is used by ==.
Tests for !=. The default implementation is almost always sufficient,
and should not be overridden without very good reason.
This method returns an ordering between
self and
other values if one exists.
Read more Tests less than (for
self and
other) and is used by the
< operator.
Read more Tests less than or equal to (for
self and
other) and is used by the
<= operator.
Read more Tests greater than (for
self and
other) and is used by the
>
operator.
Read more Tests greater than or equal to (for
self and
other) and is used by
the
>= operator.
Read more Immutably borrows from an owned value.
Read more Mutably borrows from an owned value.
Read more 🔬 This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from
self to
dest.
Read more Returns the argument unchanged.
Calls U::from(self).
That is, this conversion is whatever the implementation of
From <T> for U chooses to do.
🔬 This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning.
Read more Uses borrowed data to replace owned data, usually by cloning.
Read more The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.