pub unsafe trait CompactArcDrop {
// Required method
unsafe fn drop_and_dealloc(ptr: *mut u8);
}Expand description
Trait for type-specific drop and deallocation logic.
This trait enables compile-time dispatch for dropping CompactArc contents, replacing the previous runtime function pointer approach. Since Rust monomorphizes generics, the compiler resolves the correct implementation at compile time - making this both smaller (no stored pointer) and faster (direct call instead of indirect).
§Safety
Implementations must correctly drop T’s data and deallocate the header+data allocation using the correct Layout. This trait is auto-implemented for all types used with CompactArc.
Required Methods§
Sourceunsafe fn drop_and_dealloc(ptr: *mut u8)
unsafe fn drop_and_dealloc(ptr: *mut u8)
Drop the contained data and deallocate the header+data allocation.
§Safety
ptr must point to a valid, exclusively-owned CompactArc allocation
(starting at the Header) that was created by CompactArc’s constructors.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".