Function aligned_ptr::ptr::drop_in_place[][src]

pub unsafe fn drop_in_place<T>(to_drop: *mut T)
Expand description

The wrapper of core::ptr::drop_in_place which panics if the passed pointer is null or not aligned.

Note that the original function accepts types which are not Sized. However, this function only accepts types which are Sized.

Safety

The caller must follow the safety rules required by core::ptr::drop_in_place except the alignment and null rules.

Examples

use aligned_ptr::ptr;
use aligned_ptr::Error;

let b = Box::new(3);
let p = Box::into_raw(b);
unsafe { ptr::drop_in_place(p) };