pub trait Finalize: Sized {
// Provided method
unsafe fn finalize_raw(data: *mut ()) { ... }
}Expand description
Drops a value through a raw pointer.
Type-erased containers keep Finalize::finalize_raw as a function
pointer and call it when the value goes away. Implemented for every type.
Provided Methods§
Sourceunsafe fn finalize_raw(data: *mut ())
unsafe fn finalize_raw(data: *mut ())
Drops the value stored at data in place.
§Safety
data must point at an initialized Self that nothing else reads
afterwards. The value is read out unaligned and dropped, so calling this
twice on the same pointer is a double free.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".