bevy_reflect

Trait Reflectable

Source
pub trait Reflectable:
    Reflect
    + GetTypeRegistration
    + Typed
    + TypePath { }
Expand description

A catch-all trait that is bound by the core reflection traits, useful to simplify reflection-based generic type bounds.

You do not need to implement this trait manually. It is automatically implemented for all types that implement its supertraits. And these supertraits are all automatically derived with the Reflect derive macro.

This should namely be used to bound generic arguments to the necessary traits for reflection. Doing this has the added benefit of reducing migration costs, as a change to the required traits is automatically handled by this trait.

For now, the supertraits of this trait includes:

§Example

#[derive(Reflect)]
struct MyStruct<T: Reflectable> {
    value: T
}

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.

Implementors§