#[repr(transparent)]pub struct TraitObjectPtr(pub *const TraitObjectStorage);Expand description
Owning newtype around *const TraitObjectStorage carrying one
v2-raw refcount share on the pointed-to allocation’s HeapHeader.
Wave 2 Round 4 D4 ckpt-final-prime² (2026-05-14): mirrors the
TypedObjectPtr precedent (above) for TraitObjectStorage. Carrier
shape used as both:
HeapValue::TraitObject(TraitObjectPtr)variant payload- Future
TypedArrayData::TraitObjectelement type (if/when the §Q25.A monomorphic specialization for trait-object-element arrays lands; not under this ckpt’s scope)
#[repr(transparent)] so the in-memory layout is identical to
*const TraitObjectStorage — zero ABI cost vs the raw pointer; the
wrapper exists only to localize the manual Send/Sync impl + the
Drop/Clone refcount discipline. Same auto-trait suppression rule
applies as for TypedObjectPtr — per-T newtype is the canonical
workaround for raw-ptr inner elements in HeapValue variant payloads
without disabling Rust’s auto-derived Send/Sync/Clone/Drop on the
enclosing HeapValue enum.
Construction-side contract: callers transfer one strong-count share
on the v2-raw HeapHeader (initialized to 1 via TraitObjectStorage::_new)
to the new TraitObjectPtr. Reads via as_ptr() return the
underlying pointer without bumping refcount.
Tuple Fields§
§0: *const TraitObjectStorageImplementations§
Source§impl TraitObjectPtr
impl TraitObjectPtr
Sourcepub fn new(ptr: *const TraitObjectStorage) -> Self
pub fn new(ptr: *const TraitObjectStorage) -> Self
Construct from a raw pointer obtained via TraitObjectStorage::_new.
The caller transfers one strong-count share to the wrapper.
Sourcepub fn as_ptr(&self) -> *const TraitObjectStorage
pub fn as_ptr(&self) -> *const TraitObjectStorage
Recover the underlying raw pointer. Does NOT bump refcount; the returned pointer is borrowed for the wrapper’s lifetime.
Sourcepub fn into_raw(self) -> *const TraitObjectStorage
pub fn into_raw(self) -> *const TraitObjectStorage
Consume the wrapper without running Drop, returning the raw
pointer. The caller takes over the one refcount share. Mirror
of Arc::into_raw.
Methods from Deref<Target = TraitObjectStorage>§
Sourcepub fn method(&self, name: &str) -> Option<&VTableEntry>
pub fn method(&self, name: &str) -> Option<&VTableEntry>
Convenience: look up a method by name in the vtable. Returns
None for an unknown method (the dispatch tier surfaces this
as a runtime error — under universal-dyn there is no compile-
time ETO-002 for “method not in trait” since the trait’s
declared method set is the surface checked at compile time;
runtime lookup failures indicate a vtable-construction bug).
Sourcepub fn vtable_eq(&self, other: &Self) -> bool
pub fn vtable_eq(&self, other: &Self) -> bool
Identity check for the §Q25.C.2 Self-arg runtime contract.
Arc::ptr_eq on vtable Arcs is the tightest comparison; both
TraitObjectStorage instances must share the same vtable
allocation (which happens when both came from the same
(impl Trait for Type) pair).
Trait Implementations§
Source§impl Clone for TraitObjectPtr
impl Clone for TraitObjectPtr
Source§impl Debug for TraitObjectPtr
impl Debug for TraitObjectPtr
Source§impl Default for TraitObjectPtr
impl Default for TraitObjectPtr
Source§impl Deref for TraitObjectPtr
impl Deref for TraitObjectPtr
Source§type Target = TraitObjectStorage
type Target = TraitObjectStorage
Source§fn deref(&self) -> &TraitObjectStorage
fn deref(&self) -> &TraitObjectStorage
Source§impl Drop for TraitObjectPtr
impl Drop for TraitObjectPtr
Source§impl Hash for TraitObjectPtr
impl Hash for TraitObjectPtr
Source§impl HashMapValueElem for TraitObjectPtr
impl HashMapValueElem for TraitObjectPtr
Source§unsafe fn release_typed_array(ptr: *mut TypedArray<Self>)
unsafe fn release_typed_array(ptr: *mut TypedArray<Self>)
Mirror of the TypedObjectPtr impl above; per-element Drop runs
release_elem on *const TraitObjectStorage.
Source§unsafe fn release_owned(_value: Self)
unsafe fn release_owned(_value: Self)
release_elem on the pointer. For Ptr-newtype
V the wrapper’s Drop runs automatically when the value drops. Read moreSource§impl PartialEq for TraitObjectPtr
impl PartialEq for TraitObjectPtr
Source§fn eq(&self, other: &TraitObjectPtr) -> bool
fn eq(&self, other: &TraitObjectPtr) -> bool
self and other values to be equal, and is used by ==.