Skip to main content

Destructor

Trait Destructor 

Source
pub trait Destructor: Send + Sync {
    // Required method
    unsafe fn destroy(&self, pointer: *mut ());
}
Expand description

Drops a value whose type has no Rust counterpart.

A Rust type drops itself through Finalize::finalize_raw, which is a plain function pointer. A runtime type has no such function, because the type is a list of fields that is known only at runtime. The object that holds the field list implements this trait instead.

intuicio-core implements it on Type, which drops each field in turn.

Required Methods§

Source

unsafe fn destroy(&self, pointer: *mut ())

Drops the value at pointer in place.

§Safety

Same conditions as Finalize::finalize_raw: pointer must hold an initialized value of the described type that nothing reads afterwards, and calling this twice on one pointer is a double free.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§