Skip to main content

FromType

Trait FromType 

pub trait FromType<T> {
    // Required method
    fn from_type() -> Self;

    // Provided method
    fn insert_dependencies(_type_registration: &mut TypeRegistration) { ... }
}
Expand description

Trait used to generate TypeData for trait reflection.

This is used by the #[derive(Reflect)] macro to generate an implementation of TypeData to pass to TypeRegistration::insert.

Required Methods§

fn from_type() -> Self

Creates an instance of Self for type T.

Provided Methods§

fn insert_dependencies(_type_registration: &mut TypeRegistration)

Inserts TypeData dependencies of this TypeData. This is especially useful for trait TypeData that has a supertrait (ex: A: B). When the TypeData for A is inserted, the B TypeData will also be inserted.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

§

impl<T> FromType<T> for ReflectAdd
where T: Reflect + Add, <T as Add>::Output: Reflect,

§

impl<T> FromType<T> for ReflectAddAssign
where T: Reflect + AddAssign,

§

impl<T> FromType<T> for ReflectDefault
where T: Reflect + Default,

§

impl<T> FromType<T> for ReflectDeserialize
where T: for<'a> Deserialize<'a> + Reflect,

§

impl<T> FromType<T> for ReflectDeserializeWithRegistry
where T: PartialReflect + for<'de> DeserializeWithRegistry<'de>,

§

impl<T> FromType<T> for ReflectDiv
where T: Reflect + Div, <T as Div>::Output: Reflect,

§

impl<T> FromType<T> for ReflectDivAssign
where T: Reflect + DivAssign,

§

impl<T> FromType<T> for ReflectFromPtr
where T: Reflect,

§

impl<T> FromType<T> for ReflectFromReflect
where T: FromReflect,

§

impl<T> FromType<T> for ReflectMul
where T: Reflect + Mul, <T as Mul>::Output: Reflect,

§

impl<T> FromType<T> for ReflectMulAssign
where T: Reflect + MulAssign,

§

impl<T> FromType<T> for ReflectRem
where T: Reflect + Rem, <T as Rem>::Output: Reflect,

§

impl<T> FromType<T> for ReflectRemAssign
where T: Reflect + RemAssign,

§

impl<T> FromType<T> for ReflectSerialize

§

impl<T> FromType<T> for ReflectSerializeWithRegistry

§

impl<T> FromType<T> for ReflectSub
where T: Reflect + Sub, <T as Sub>::Output: Reflect,

§

impl<T> FromType<T> for ReflectSubAssign
where T: Reflect + SubAssign,