Trait bevy::prelude::FromReflect
pub trait FromReflect: Reflect + Sized {
fn from_reflect(reflect: &(dyn Reflect + 'static)) -> Option<Self>;
}
Expand description
A trait for types which can be constructed from a reflected type.
This trait can be derived on types which implement Reflect
. Some complex
types (such as Vec<T>
) may only be reflected if their element types
implement this trait.
For structs and tuple structs, fields marked with the #[reflect(ignore)]
attribute will be constructed using the Default
implementation of the
field type, rather than the corresponding field value (if any) of the
reflected value.
Required Methods§
fn from_reflect(reflect: &(dyn Reflect + 'static)) -> Option<Self>
fn from_reflect(reflect: &(dyn Reflect + 'static)) -> Option<Self>
Constructs a concrete instance of Self
from a reflected value.