Skip to main content

DowncastType

Trait DowncastType 

Source
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_KEY uniquely identifies this exact concrete Rust type among all DowncastType implementations 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§

Source

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".

Implementations on Foreign Types§

Source§

impl DowncastType for ()

Source§

impl DowncastType for TextComponent

Source§

impl DowncastType for bool

Source§

impl DowncastType for f32

Source§

impl DowncastType for i32

Implementors§