pub trait UniquePtrTarget: Sized {
// Required methods
unsafe fn ptr_new() -> *mut Self;
unsafe fn ptr_drop(ptr: *mut Self);
}
Expand description
Trait, which allows type to be used in UniquePtr
Required Methods§
Sourceunsafe fn ptr_new() -> *mut Self
unsafe fn ptr_new() -> *mut Self
Allocates Self
in the heap and returns pointer.
§Safety
Pointer must be deallocated by calling Self::ptr_drop() when no longer needed.
Sourceunsafe fn ptr_drop(ptr: *mut Self)
unsafe fn ptr_drop(ptr: *mut Self)
Destroys pointer allocated in ptr_new()
.
§Safety
Pointer must have been created by Self::ptr_new() and is no longer aliased.
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.