Skip to main content

UniquePtrTarget

Trait UniquePtrTarget 

Source
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§

Source

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.

Source

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".

Implementors§