Trait Capable
pub unsafe trait Capable {
// Required method
fn vtable(capability: TypeId) -> Option<NonNull<()>>;
}
Expand description
Used to cast an element to a trait object for a trait it implements.
§Safety
If the vtable
function returns Some(p)
, then p
must be a valid pointer
to a vtable of Packed<Self>
w.r.t to the trait C
where capability
is
TypeId::of::<dyn C>()
.
Required Methods§
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.