#[repr(C)]pub struct ObjectArc<T: ObjectCore> { /* private fields */ }Expand description
Arc-like wrapper for Object that allows shared ownership
\tparam T The type of the object to be wrapped
Implementations§
Source§impl<T: ObjectCore> ObjectArc<T>
impl<T: ObjectCore> ObjectArc<T>
Sourcepub fn new_with_extra_items<U>(data: T) -> Selfwhere
T: ObjectCoreWithExtraItems<ExtraItem = U>,
pub 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.
Sourcepub unsafe fn from_raw(ptr: *const T) -> Self
pub unsafe fn from_raw(ptr: *const T) -> Self
Move a previously allocated object into the ObjectArc
§Arguments
ptr- The raw pointer to move into the ObjectArc
§Returns
ObjectArc<T>- The ObjectArc \return The ObjectArc
§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 unsafe fn as_raw(this: &Self) -> *const T
pub unsafe fn as_raw(this: &Self) -> *const T
Get the raw pointer from the ObjectArc
Caller should view this as a non-owning reference
§Arguments
this- The ObjectArc to get the raw pointer
§Returns
*const T- The raw pointer \return The raw pointer
§Safety
Access must respect existing borrows, and the pointer cannot outlive an owning handle. The object and header must not be moved or replaced.
Sourcepub unsafe fn as_raw_mut(this: &mut Self) -> *mut T
pub unsafe fn as_raw_mut(this: &mut Self) -> *mut T
Get the raw mutable pointer from the ObjectArc
Caller should view this as a non-owning reference
§Arguments
this- The ObjectArc to get the raw pointer
§Returns
*mut T- The raw pointer
§Safety
The handle need not be unique. The caller must establish exclusive access for each mutation and must not move or replace the object or its header.