VTableMetaDropInPlace

Trait VTableMetaDropInPlace 

Source
pub unsafe trait VTableMetaDropInPlace: VTableMeta {
    // Required methods
    unsafe fn drop_in_place(vtable: &Self::VTable, ptr: *mut u8) -> Layout;
    unsafe fn dealloc(vtable: &Self::VTable, ptr: *mut u8, layout: Layout);
}
Expand description

This trait is implemented by the #[vtable] macro.

It is implemented if the macro has a “drop_in_place” function.

§Safety

The implementation of drop_in_place and dealloc must be correct

Required Methods§

Source

unsafe fn drop_in_place(vtable: &Self::VTable, ptr: *mut u8) -> Layout

§Safety

The target ptr argument needs to be pointing to a an instance of the VTable after the call to this function, the memory is still there but no longer contains a valid object.

Source

unsafe fn dealloc(vtable: &Self::VTable, ptr: *mut u8, layout: Layout)

§Safety

The target ptr must have been allocated by the same allocator as the one which the vtable will delegate to.

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.

Implementors§