Trait bevy_reflect::Typed
source · pub trait Typed: Reflect + TypePath {
// Required method
fn type_info() -> &'static TypeInfo;
}
Expand description
A static accessor to compile-time type information.
This trait is automatically implemented by the #[derive(Reflect)]
macro
and allows type information to be processed without an instance of that type.
§Implementing
While it is recommended to leave implementing this trait to the #[derive(Reflect)]
macro,
it is possible to implement this trait manually. If a manual implementation is needed,
you must ensure that the information you provide is correct, otherwise various systems that
rely on this trait may fail in unexpected ways.
Implementors may have difficulty in generating a reference to TypeInfo
with a static
lifetime. Luckily, this crate comes with some utility structs, to make generating these
statics much simpler.
§Example
use bevy_reflect::Typed;
struct MyStruct {
foo: usize,
bar: (f32, f32)
}
impl Typed for MyStruct {
fn type_info() -> &'static TypeInfo {
static CELL: NonGenericTypeInfoCell = NonGenericTypeInfoCell::new();
CELL.get_or_set(|| {
let fields = [
NamedField::new::<usize >("foo"),
NamedField::new::<(f32, f32) >("bar"),
];
let info = StructInfo::new::<Self>(&fields);
TypeInfo::Struct(info)
})
}
}
Required Methods§
Object Safety§
This trait is not object safe.
Implementations on Foreign Types§
source§impl Typed for Affine2where
Self: Any + Send + Sync,
Mat2: FromReflect + TypePath + RegisterForReflection,
Vec2: FromReflect + TypePath + RegisterForReflection,
Available on crate feature glam
only.
impl Typed for Affine2where
Self: Any + Send + Sync,
Mat2: FromReflect + TypePath + RegisterForReflection,
Vec2: FromReflect + TypePath + RegisterForReflection,
Available on crate feature
glam
only.source§impl Typed for Affine3Awhere
Self: Any + Send + Sync,
Mat3A: FromReflect + TypePath + RegisterForReflection,
Vec3A: FromReflect + TypePath + RegisterForReflection,
Available on crate feature glam
only.
impl Typed for Affine3Awhere
Self: Any + Send + Sync,
Mat3A: FromReflect + TypePath + RegisterForReflection,
Vec3A: FromReflect + TypePath + RegisterForReflection,
Available on crate feature
glam
only.source§impl Typed for DAffine2where
Self: Any + Send + Sync,
DMat2: FromReflect + TypePath + RegisterForReflection,
DVec2: FromReflect + TypePath + RegisterForReflection,
Available on crate feature glam
only.
impl Typed for DAffine2where
Self: Any + Send + Sync,
DMat2: FromReflect + TypePath + RegisterForReflection,
DVec2: FromReflect + TypePath + RegisterForReflection,
Available on crate feature
glam
only.source§impl Typed for DAffine3where
Self: Any + Send + Sync,
DMat3: FromReflect + TypePath + RegisterForReflection,
DVec3: FromReflect + TypePath + RegisterForReflection,
Available on crate feature glam
only.
impl Typed for DAffine3where
Self: Any + Send + Sync,
DMat3: FromReflect + TypePath + RegisterForReflection,
DVec3: FromReflect + TypePath + RegisterForReflection,
Available on crate feature
glam
only.source§impl Typed for NonZeroI16
impl Typed for NonZeroI16
source§impl Typed for NonZeroI32
impl Typed for NonZeroI32
source§impl Typed for NonZeroI64
impl Typed for NonZeroI64
source§impl Typed for NonZeroI128
impl Typed for NonZeroI128
source§impl Typed for NonZeroIsize
impl Typed for NonZeroIsize
source§impl Typed for NonZeroU16
impl Typed for NonZeroU16
source§impl Typed for NonZeroU32
impl Typed for NonZeroU32
source§impl Typed for NonZeroU64
impl Typed for NonZeroU64
source§impl Typed for NonZeroU128
impl Typed for NonZeroU128
source§impl Typed for NonZeroUsize
impl Typed for NonZeroUsize
source§impl<A: Reflect + TypePath + GetTypeRegistration, B: Reflect + TypePath + GetTypeRegistration> Typed for (A, B)
impl<A: Reflect + TypePath + GetTypeRegistration, B: Reflect + TypePath + GetTypeRegistration> Typed for (A, B)
source§impl<A: Reflect + TypePath + GetTypeRegistration, B: Reflect + TypePath + GetTypeRegistration, C: Reflect + TypePath + GetTypeRegistration> Typed for (A, B, C)
impl<A: Reflect + TypePath + GetTypeRegistration, B: Reflect + TypePath + GetTypeRegistration, C: Reflect + TypePath + GetTypeRegistration> Typed for (A, B, C)
source§impl<A: Reflect + TypePath + GetTypeRegistration, B: Reflect + TypePath + GetTypeRegistration, C: Reflect + TypePath + GetTypeRegistration, D: Reflect + TypePath + GetTypeRegistration> Typed for (A, B, C, D)
impl<A: Reflect + TypePath + GetTypeRegistration, B: Reflect + TypePath + GetTypeRegistration, C: Reflect + TypePath + GetTypeRegistration, D: Reflect + TypePath + GetTypeRegistration> Typed for (A, B, C, D)
source§impl<A: Reflect + TypePath + GetTypeRegistration, B: Reflect + TypePath + GetTypeRegistration, C: Reflect + TypePath + GetTypeRegistration, D: Reflect + TypePath + GetTypeRegistration, E: Reflect + TypePath + GetTypeRegistration> Typed for (A, B, C, D, E)
impl<A: Reflect + TypePath + GetTypeRegistration, B: Reflect + TypePath + GetTypeRegistration, C: Reflect + TypePath + GetTypeRegistration, D: Reflect + TypePath + GetTypeRegistration, E: Reflect + TypePath + GetTypeRegistration> Typed for (A, B, C, D, E)
source§impl<A: Reflect + TypePath + GetTypeRegistration, B: Reflect + TypePath + GetTypeRegistration, C: Reflect + TypePath + GetTypeRegistration, D: Reflect + TypePath + GetTypeRegistration, E: Reflect + TypePath + GetTypeRegistration, F: Reflect + TypePath + GetTypeRegistration> Typed for (A, B, C, D, E, F)
impl<A: Reflect + TypePath + GetTypeRegistration, B: Reflect + TypePath + GetTypeRegistration, C: Reflect + TypePath + GetTypeRegistration, D: Reflect + TypePath + GetTypeRegistration, E: Reflect + TypePath + GetTypeRegistration, F: Reflect + TypePath + GetTypeRegistration> Typed for (A, B, C, D, E, F)
source§impl<A: Reflect + TypePath + GetTypeRegistration, B: Reflect + TypePath + GetTypeRegistration, C: Reflect + TypePath + GetTypeRegistration, D: Reflect + TypePath + GetTypeRegistration, E: Reflect + TypePath + GetTypeRegistration, F: Reflect + TypePath + GetTypeRegistration, G: Reflect + TypePath + GetTypeRegistration> Typed for (A, B, C, D, E, F, G)
impl<A: Reflect + TypePath + GetTypeRegistration, B: Reflect + TypePath + GetTypeRegistration, C: Reflect + TypePath + GetTypeRegistration, D: Reflect + TypePath + GetTypeRegistration, E: Reflect + TypePath + GetTypeRegistration, F: Reflect + TypePath + GetTypeRegistration, G: Reflect + TypePath + GetTypeRegistration> Typed for (A, B, C, D, E, F, G)
source§impl<A: Reflect + TypePath + GetTypeRegistration, B: Reflect + TypePath + GetTypeRegistration, C: Reflect + TypePath + GetTypeRegistration, D: Reflect + TypePath + GetTypeRegistration, E: Reflect + TypePath + GetTypeRegistration, F: Reflect + TypePath + GetTypeRegistration, G: Reflect + TypePath + GetTypeRegistration, H: Reflect + TypePath + GetTypeRegistration> Typed for (A, B, C, D, E, F, G, H)
impl<A: Reflect + TypePath + GetTypeRegistration, B: Reflect + TypePath + GetTypeRegistration, C: Reflect + TypePath + GetTypeRegistration, D: Reflect + TypePath + GetTypeRegistration, E: Reflect + TypePath + GetTypeRegistration, F: Reflect + TypePath + GetTypeRegistration, G: Reflect + TypePath + GetTypeRegistration, H: Reflect + TypePath + GetTypeRegistration> Typed for (A, B, C, D, E, F, G, H)
source§impl<A: Reflect + TypePath + GetTypeRegistration, B: Reflect + TypePath + GetTypeRegistration, C: Reflect + TypePath + GetTypeRegistration, D: Reflect + TypePath + GetTypeRegistration, E: Reflect + TypePath + GetTypeRegistration, F: Reflect + TypePath + GetTypeRegistration, G: Reflect + TypePath + GetTypeRegistration, H: Reflect + TypePath + GetTypeRegistration, I: Reflect + TypePath + GetTypeRegistration> Typed for (A, B, C, D, E, F, G, H, I)
impl<A: Reflect + TypePath + GetTypeRegistration, B: Reflect + TypePath + GetTypeRegistration, C: Reflect + TypePath + GetTypeRegistration, D: Reflect + TypePath + GetTypeRegistration, E: Reflect + TypePath + GetTypeRegistration, F: Reflect + TypePath + GetTypeRegistration, G: Reflect + TypePath + GetTypeRegistration, H: Reflect + TypePath + GetTypeRegistration, I: Reflect + TypePath + GetTypeRegistration> Typed for (A, B, C, D, E, F, G, H, I)
source§impl<A: Reflect + TypePath + GetTypeRegistration, B: Reflect + TypePath + GetTypeRegistration, C: Reflect + TypePath + GetTypeRegistration, D: Reflect + TypePath + GetTypeRegistration, E: Reflect + TypePath + GetTypeRegistration, F: Reflect + TypePath + GetTypeRegistration, G: Reflect + TypePath + GetTypeRegistration, H: Reflect + TypePath + GetTypeRegistration, I: Reflect + TypePath + GetTypeRegistration, J: Reflect + TypePath + GetTypeRegistration> Typed for (A, B, C, D, E, F, G, H, I, J)
impl<A: Reflect + TypePath + GetTypeRegistration, B: Reflect + TypePath + GetTypeRegistration, C: Reflect + TypePath + GetTypeRegistration, D: Reflect + TypePath + GetTypeRegistration, E: Reflect + TypePath + GetTypeRegistration, F: Reflect + TypePath + GetTypeRegistration, G: Reflect + TypePath + GetTypeRegistration, H: Reflect + TypePath + GetTypeRegistration, I: Reflect + TypePath + GetTypeRegistration, J: Reflect + TypePath + GetTypeRegistration> Typed for (A, B, C, D, E, F, G, H, I, J)
source§impl<A: Reflect + TypePath + GetTypeRegistration, B: Reflect + TypePath + GetTypeRegistration, C: Reflect + TypePath + GetTypeRegistration, D: Reflect + TypePath + GetTypeRegistration, E: Reflect + TypePath + GetTypeRegistration, F: Reflect + TypePath + GetTypeRegistration, G: Reflect + TypePath + GetTypeRegistration, H: Reflect + TypePath + GetTypeRegistration, I: Reflect + TypePath + GetTypeRegistration, J: Reflect + TypePath + GetTypeRegistration, K: Reflect + TypePath + GetTypeRegistration> Typed for (A, B, C, D, E, F, G, H, I, J, K)
impl<A: Reflect + TypePath + GetTypeRegistration, B: Reflect + TypePath + GetTypeRegistration, C: Reflect + TypePath + GetTypeRegistration, D: Reflect + TypePath + GetTypeRegistration, E: Reflect + TypePath + GetTypeRegistration, F: Reflect + TypePath + GetTypeRegistration, G: Reflect + TypePath + GetTypeRegistration, H: Reflect + TypePath + GetTypeRegistration, I: Reflect + TypePath + GetTypeRegistration, J: Reflect + TypePath + GetTypeRegistration, K: Reflect + TypePath + GetTypeRegistration> Typed for (A, B, C, D, E, F, G, H, I, J, K)
source§impl<A: Reflect + TypePath + GetTypeRegistration, B: Reflect + TypePath + GetTypeRegistration, C: Reflect + TypePath + GetTypeRegistration, D: Reflect + TypePath + GetTypeRegistration, E: Reflect + TypePath + GetTypeRegistration, F: Reflect + TypePath + GetTypeRegistration, G: Reflect + TypePath + GetTypeRegistration, H: Reflect + TypePath + GetTypeRegistration, I: Reflect + TypePath + GetTypeRegistration, J: Reflect + TypePath + GetTypeRegistration, K: Reflect + TypePath + GetTypeRegistration, L: Reflect + TypePath + GetTypeRegistration> Typed for (A, B, C, D, E, F, G, H, I, J, K, L)
impl<A: Reflect + TypePath + GetTypeRegistration, B: Reflect + TypePath + GetTypeRegistration, C: Reflect + TypePath + GetTypeRegistration, D: Reflect + TypePath + GetTypeRegistration, E: Reflect + TypePath + GetTypeRegistration, F: Reflect + TypePath + GetTypeRegistration, G: Reflect + TypePath + GetTypeRegistration, H: Reflect + TypePath + GetTypeRegistration, I: Reflect + TypePath + GetTypeRegistration, J: Reflect + TypePath + GetTypeRegistration, K: Reflect + TypePath + GetTypeRegistration, L: Reflect + TypePath + GetTypeRegistration> Typed for (A, B, C, D, E, F, G, H, I, J, K, L)
source§impl<K, V> Typed for BTreeMap<K, V>where
K: FromReflect + TypePath + GetTypeRegistration + Eq + Ord,
V: FromReflect + TypePath + GetTypeRegistration,
impl<K, V> Typed for BTreeMap<K, V>where
K: FromReflect + TypePath + GetTypeRegistration + Eq + Ord,
V: FromReflect + TypePath + GetTypeRegistration,
source§impl<K, V, S> Typed for HashMap<K, V, S>where
K: FromReflect + TypePath + GetTypeRegistration + Eq + Hash,
V: FromReflect + TypePath + GetTypeRegistration,
S: TypePath + BuildHasher + Send + Sync,
impl<K, V, S> Typed for HashMap<K, V, S>where
K: FromReflect + TypePath + GetTypeRegistration + Eq + Hash,
V: FromReflect + TypePath + GetTypeRegistration,
S: TypePath + BuildHasher + Send + Sync,
source§impl<K, V, S> Typed for HashMap<K, V, S>where
K: FromReflect + TypePath + GetTypeRegistration + Eq + Hash,
V: FromReflect + TypePath + GetTypeRegistration,
S: TypePath + BuildHasher + Send + Sync,
impl<K, V, S> Typed for HashMap<K, V, S>where
K: FromReflect + TypePath + GetTypeRegistration + Eq + Hash,
V: FromReflect + TypePath + GetTypeRegistration,
S: TypePath + BuildHasher + Send + Sync,
source§impl<T> Typed for BinaryHeap<T>
impl<T> Typed for BinaryHeap<T>
source§impl<T> Typed for Saturating<T>
impl<T> Typed for Saturating<T>
source§impl<T> Typed for RangeInclusive<T>
impl<T> Typed for RangeInclusive<T>
source§impl<T> Typed for RangeToInclusive<T>
impl<T> Typed for RangeToInclusive<T>
source§impl<T, E> Typed for Result<T, E>where
Self: Any + Send + Sync,
T: TypePath + FromReflect + RegisterForReflection,
E: TypePath + FromReflect + RegisterForReflection,
impl<T, E> Typed for Result<T, E>where
Self: Any + Send + Sync,
T: TypePath + FromReflect + RegisterForReflection,
E: TypePath + FromReflect + RegisterForReflection,
source§impl<T: Array + TypePath + Send + Sync + 'static> Typed for SmallVec<T>
Available on crate feature smallvec
only.
impl<T: Array + TypePath + Send + Sync + 'static> Typed for SmallVec<T>
Available on crate feature
smallvec
only.