Skip to main content

ManagedPtr

Trait ManagedPtr 

Source
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 P actually manages the lifetime of its Target (i.e., it holds exclusive or shared ownership of the target).
  • Dropping the pointer P must 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.

Implementors§