pub unsafe trait DowncastType: 'static {
const TYPE_KEY: DowncastTypeKey;
}Expand description
Assigns a deterministic downcast key to a concrete Rust type.
This trait does not assert that the type has a stable ABI. A plugin may use it to recover types that plugin owns, but a key alone never permits one compilation unit to reinterpret another compilation unit’s private type.
§Safety
Implementors must guarantee that:
TYPE_KEYuniquely identifies this exact concrete Rust type among allDowncastTypeimplementations that may coexist in the process.- No separately defined type uses the same key, even if it currently has an identical layout.
- Versions of a type that may coexist use different keys unless they are the same concrete Rust type to every caller that can perform the downcast.
Required Associated Constants§
Sourceconst TYPE_KEY: DowncastTypeKey
const TYPE_KEY: DowncastTypeKey
The process-wide key for this concrete type.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".