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§
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementors§
impl Destructor for Type
A runtime type destroys its values by walking its own fields.
This is why a Finalizer can hold an object instead of a bare function
pointer. The walk needs the field list, and a function pointer cannot carry
one. Only a runtime type gets this. A native type answers
Type::finalizer with its Rust destructor.