[−][src]Function smart_ptr::boxed_deleter
pub unsafe fn boxed_deleter<T>(ptr: *mut u8)
Default Rust deleter.
Invokes destructor and de-allocates memory using global allocator, using Box.
It can be useful when one would want to allow type erasure,
but it is UB to specify invalid T
use smart_ptr::Unique; let var = Box::new("test".to_string()); unsafe { smart_ptr::boxed_deleter::<String>(Box::leak(var) as *mut String as *mut u8); }
Warning
Remember that things can get complicated when you cast from fat ptrs(with vtable)