pub unsafe trait ManagedPtr: PtrTraits { }Expand description
Marker trait for managed pointer types (like UniquePtr and RefPtr).
§Safety
Implementing this trait is unsafe because:
- The implementer must guarantee that the pointer type
Pactually manages the lifetime of itsTarget(i.e., it holds exclusive or shared ownership of the target). - Dropping the pointer
Pmust correctly release the reference/ownership, causing the target to be dropped and cleaned up once there are no more owners. - The target object must be guaranteed to outlive its reference in the list while contained.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.