pub struct ObjectArc<T: ObjectCore> { /* private fields */ }Expand description
A reference-counted pointer to an object T, as Arc<T>, counting with
the object header so that every language shares the count.
Implementations§
Source§impl<T: ObjectCore> ObjectArc<T>
impl<T: ObjectCore> ObjectArc<T>
Sourcepub unsafe fn new_with_extra_items<U>(data: T) -> Selfwhere
T: ObjectCoreWithExtraItems<ExtraItem = U>,
pub unsafe fn new_with_extra_items<U>(data: T) -> Selfwhere
T: ObjectCoreWithExtraItems<ExtraItem = U>,
Allocate a stable object followed by its type’s extra item storage.
§Safety
The extra items start uninitialized: the caller writes each of them,
through ObjectCoreWithExtraItems::extra_items_ptr of
as_mut_ptr, before the object is read or shared.
Sourcepub unsafe fn from_raw(ptr: *const T) -> Self
pub unsafe fn from_raw(ptr: *const T) -> Self
Take ownership of a raw object pointer, as Arc::from_raw.
§Arguments
ptr- A pointer that owns one strong reference.
§Returns
The handle that owns that reference.
§Safety
ptr must own one strong reference to a live, stable managed allocation
whose dynamic type is compatible with T and whose payload is valid.
Ownership of that reference is transferred into the returned handle.
Sourcepub fn into_raw(this: Self) -> *const T
pub fn into_raw(this: Self) -> *const T
Turn the handle into a raw pointer, as Arc::into_raw.
§Arguments
this- The handle.
§Returns
The pointer, which owns the strong reference; pass it back to
ObjectArc::from_raw to release it.
Sourcepub fn as_mut_ptr(this: &mut Self) -> *mut T
pub fn as_mut_ptr(this: &mut Self) -> *mut T
Sourcepub fn strong_count(this: &Self) -> usize
pub fn strong_count(this: &Self) -> usize
Sourcepub fn is_unique(this: &Self) -> bool
pub fn is_unique(this: &Self) -> bool
Whether this is the only reference, strong and with no weak one, so the object may be mutated in place.
§Arguments
this- The handle.
Sourcepub fn weak_count(this: &Self) -> usize
pub fn weak_count(this: &Self) -> usize
The number of weak references, as Arc::weak_count: the weak
reference that the strong references hold together is not counted.
§Arguments
this- The handle.