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§

source

fn type_info() -> &'static TypeInfo

Returns the compile-time info for the underlying type.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl Typed for &'static str

source§

fn type_info() -> &'static TypeInfo

source§

impl Typed for &'static Path

source§

fn type_info() -> &'static TypeInfo

source§

impl Typed for Cow<'static, str>

source§

fn type_info() -> &'static TypeInfo

source§

impl Typed for Cow<'static, Path>

source§

fn type_info() -> &'static TypeInfo

source§

impl Typed for EulerRot
where Self: Any + Send + Sync,

Available on crate feature glam only.
source§

fn type_info() -> &'static TypeInfo

source§

impl Typed for bool
where Self: Any + Send + Sync,

source§

fn type_info() -> &'static TypeInfo

source§

impl Typed for char
where Self: Any + Send + Sync,

source§

fn type_info() -> &'static TypeInfo

source§

impl Typed for f32
where Self: Any + Send + Sync,

source§

fn type_info() -> &'static TypeInfo

source§

impl Typed for f64
where Self: Any + Send + Sync,

source§

fn type_info() -> &'static TypeInfo

source§

impl Typed for i8
where Self: Any + Send + Sync,

source§

fn type_info() -> &'static TypeInfo

source§

impl Typed for i16
where Self: Any + Send + Sync,

source§

fn type_info() -> &'static TypeInfo

source§

impl Typed for i32
where Self: Any + Send + Sync,

source§

fn type_info() -> &'static TypeInfo

source§

impl Typed for i64
where Self: Any + Send + Sync,

source§

fn type_info() -> &'static TypeInfo

source§

impl Typed for i128
where Self: Any + Send + Sync,

source§

fn type_info() -> &'static TypeInfo

source§

impl Typed for isize
where Self: Any + Send + Sync,

source§

fn type_info() -> &'static TypeInfo

source§

impl Typed for u8
where Self: Any + Send + Sync,

source§

fn type_info() -> &'static TypeInfo

source§

impl Typed for u16
where Self: Any + Send + Sync,

source§

fn type_info() -> &'static TypeInfo

source§

impl Typed for u32
where Self: Any + Send + Sync,

source§

fn type_info() -> &'static TypeInfo

source§

impl Typed for u64
where Self: Any + Send + Sync,

source§

fn type_info() -> &'static TypeInfo

source§

impl Typed for u128
where Self: Any + Send + Sync,

source§

fn type_info() -> &'static TypeInfo

source§

impl Typed for ()

source§

fn type_info() -> &'static TypeInfo

source§

impl Typed for usize
where Self: Any + Send + Sync,

source§

fn type_info() -> &'static TypeInfo

source§

impl Typed for String
where Self: Any + Send + Sync,

source§

fn type_info() -> &'static TypeInfo

source§

impl Typed for TypeId
where Self: Any + Send + Sync,

source§

fn type_info() -> &'static TypeInfo

source§

impl Typed for RangeFull
where Self: Any + Send + Sync,

source§

fn type_info() -> &'static TypeInfo

source§

impl Typed for Duration
where Self: Any + Send + Sync,

source§

fn type_info() -> &'static TypeInfo

source§

impl Typed for OsString
where Self: Any + Send + Sync,

source§

fn type_info() -> &'static TypeInfo

source§

impl Typed for PathBuf
where Self: Any + Send + Sync,

source§

fn type_info() -> &'static TypeInfo

source§

impl Typed for Instant
where Self: Any + Send + Sync,

source§

fn type_info() -> &'static TypeInfo

source§

impl Typed for BVec2
where Self: Any + Send + Sync, bool: FromReflect + TypePath + RegisterForReflection,

Available on crate feature glam only.
source§

fn type_info() -> &'static TypeInfo

source§

impl Typed for BVec3
where Self: Any + Send + Sync, bool: FromReflect + TypePath + RegisterForReflection,

Available on crate feature glam only.
source§

fn type_info() -> &'static TypeInfo

source§

impl Typed for BVec4
where Self: Any + Send + Sync, bool: FromReflect + TypePath + RegisterForReflection,

Available on crate feature glam only.
source§

fn type_info() -> &'static TypeInfo

source§

impl Typed for BVec3A
where Self: Any + Send + Sync,

Available on crate feature glam only.
source§

fn type_info() -> &'static TypeInfo

source§

impl Typed for BVec4A
where Self: Any + Send + Sync,

Available on crate feature glam only.
source§

fn type_info() -> &'static TypeInfo

source§

impl Typed for Affine2
where Self: Any + Send + Sync, Mat2: FromReflect + TypePath + RegisterForReflection, Vec2: FromReflect + TypePath + RegisterForReflection,

Available on crate feature glam only.
source§

fn type_info() -> &'static TypeInfo

source§

impl Typed for Affine3A
where Self: Any + Send + Sync, Mat3A: FromReflect + TypePath + RegisterForReflection, Vec3A: FromReflect + TypePath + RegisterForReflection,

Available on crate feature glam only.
source§

fn type_info() -> &'static TypeInfo

source§

impl Typed for Mat3
where Self: Any + Send + Sync, Vec3: FromReflect + TypePath + RegisterForReflection,

Available on crate feature glam only.
source§

fn type_info() -> &'static TypeInfo

source§

impl Typed for Mat2
where Self: Any + Send + Sync, Vec2: FromReflect + TypePath + RegisterForReflection,

Available on crate feature glam only.
source§

fn type_info() -> &'static TypeInfo

source§

impl Typed for Mat3A
where Self: Any + Send + Sync, Vec3A: FromReflect + TypePath + RegisterForReflection,

Available on crate feature glam only.
source§

fn type_info() -> &'static TypeInfo

source§

impl Typed for Mat4
where Self: Any + Send + Sync, Vec4: FromReflect + TypePath + RegisterForReflection,

Available on crate feature glam only.
source§

fn type_info() -> &'static TypeInfo

source§

impl Typed for Quat
where Self: Any + Send + Sync, f32: FromReflect + TypePath + RegisterForReflection,

Available on crate feature glam only.
source§

fn type_info() -> &'static TypeInfo

source§

impl Typed for Vec3A
where Self: Any + Send + Sync, f32: FromReflect + TypePath + RegisterForReflection,

Available on crate feature glam only.
source§

fn type_info() -> &'static TypeInfo

source§

impl Typed for Vec4
where Self: Any + Send + Sync, f32: FromReflect + TypePath + RegisterForReflection,

Available on crate feature glam only.
source§

fn type_info() -> &'static TypeInfo

source§

impl Typed for Vec2
where Self: Any + Send + Sync, f32: FromReflect + TypePath + RegisterForReflection,

Available on crate feature glam only.
source§

fn type_info() -> &'static TypeInfo

source§

impl Typed for Vec3
where Self: Any + Send + Sync, f32: FromReflect + TypePath + RegisterForReflection,

Available on crate feature glam only.
source§

fn type_info() -> &'static TypeInfo

source§

impl Typed for DAffine2
where Self: Any + Send + Sync, DMat2: FromReflect + TypePath + RegisterForReflection, DVec2: FromReflect + TypePath + RegisterForReflection,

Available on crate feature glam only.
source§

fn type_info() -> &'static TypeInfo

source§

impl Typed for DAffine3
where Self: Any + Send + Sync, DMat3: FromReflect + TypePath + RegisterForReflection, DVec3: FromReflect + TypePath + RegisterForReflection,

Available on crate feature glam only.
source§

fn type_info() -> &'static TypeInfo

source§

impl Typed for DMat2
where Self: Any + Send + Sync, DVec2: FromReflect + TypePath + RegisterForReflection,

Available on crate feature glam only.
source§

fn type_info() -> &'static TypeInfo

source§

impl Typed for DMat3
where Self: Any + Send + Sync, DVec3: FromReflect + TypePath + RegisterForReflection,

Available on crate feature glam only.
source§

fn type_info() -> &'static TypeInfo

source§

impl Typed for DMat4
where Self: Any + Send + Sync, DVec4: FromReflect + TypePath + RegisterForReflection,

Available on crate feature glam only.
source§

fn type_info() -> &'static TypeInfo

source§

impl Typed for DQuat
where Self: Any + Send + Sync, f64: FromReflect + TypePath + RegisterForReflection,

Available on crate feature glam only.
source§

fn type_info() -> &'static TypeInfo

source§

impl Typed for DVec2
where Self: Any + Send + Sync, f64: FromReflect + TypePath + RegisterForReflection,

Available on crate feature glam only.
source§

fn type_info() -> &'static TypeInfo

source§

impl Typed for DVec3
where Self: Any + Send + Sync, f64: FromReflect + TypePath + RegisterForReflection,

Available on crate feature glam only.
source§

fn type_info() -> &'static TypeInfo

source§

impl Typed for DVec4
where Self: Any + Send + Sync, f64: FromReflect + TypePath + RegisterForReflection,

Available on crate feature glam only.
source§

fn type_info() -> &'static TypeInfo

source§

impl Typed for IVec2
where Self: Any + Send + Sync, i32: FromReflect + TypePath + RegisterForReflection,

Available on crate feature glam only.
source§

fn type_info() -> &'static TypeInfo

source§

impl Typed for IVec3
where Self: Any + Send + Sync, i32: FromReflect + TypePath + RegisterForReflection,

Available on crate feature glam only.
source§

fn type_info() -> &'static TypeInfo

source§

impl Typed for IVec4
where Self: Any + Send + Sync, i32: FromReflect + TypePath + RegisterForReflection,

Available on crate feature glam only.
source§

fn type_info() -> &'static TypeInfo

source§

impl Typed for I64Vec2
where Self: Any + Send + Sync, i64: FromReflect + TypePath + RegisterForReflection,

Available on crate feature glam only.
source§

fn type_info() -> &'static TypeInfo

source§

impl Typed for I64Vec3
where Self: Any + Send + Sync, i64: FromReflect + TypePath + RegisterForReflection,

Available on crate feature glam only.
source§

fn type_info() -> &'static TypeInfo

source§

impl Typed for I64Vec4
where Self: Any + Send + Sync, i64: FromReflect + TypePath + RegisterForReflection,

Available on crate feature glam only.
source§

fn type_info() -> &'static TypeInfo

source§

impl Typed for UVec2
where Self: Any + Send + Sync, u32: FromReflect + TypePath + RegisterForReflection,

Available on crate feature glam only.
source§

fn type_info() -> &'static TypeInfo

source§

impl Typed for UVec3
where Self: Any + Send + Sync, u32: FromReflect + TypePath + RegisterForReflection,

Available on crate feature glam only.
source§

fn type_info() -> &'static TypeInfo

source§

impl Typed for UVec4
where Self: Any + Send + Sync, u32: FromReflect + TypePath + RegisterForReflection,

Available on crate feature glam only.
source§

fn type_info() -> &'static TypeInfo

source§

impl Typed for U64Vec2
where Self: Any + Send + Sync, u64: FromReflect + TypePath + RegisterForReflection,

Available on crate feature glam only.
source§

fn type_info() -> &'static TypeInfo

source§

impl Typed for U64Vec3
where Self: Any + Send + Sync, u64: FromReflect + TypePath + RegisterForReflection,

Available on crate feature glam only.
source§

fn type_info() -> &'static TypeInfo

source§

impl Typed for U64Vec4
where Self: Any + Send + Sync, u64: FromReflect + TypePath + RegisterForReflection,

Available on crate feature glam only.
source§

fn type_info() -> &'static TypeInfo

source§

impl Typed for NodeIndex
where Self: Any + Send + Sync,

Available on crate feature petgraph only.
source§

fn type_info() -> &'static TypeInfo

source§

impl Typed for SmolStr
where Self: Any + Send + Sync,

Available on crate feature smol_str only.
source§

fn type_info() -> &'static TypeInfo

source§

impl Typed for Uuid
where Self: Any + Send + Sync,

Available on crate feature uuid only.
source§

fn type_info() -> &'static TypeInfo

source§

impl Typed for NonZeroI8
where Self: Any + Send + Sync,

source§

fn type_info() -> &'static TypeInfo

source§

impl Typed for NonZeroI16
where Self: Any + Send + Sync,

source§

fn type_info() -> &'static TypeInfo

source§

impl Typed for NonZeroI32
where Self: Any + Send + Sync,

source§

fn type_info() -> &'static TypeInfo

source§

impl Typed for NonZeroI64
where Self: Any + Send + Sync,

source§

fn type_info() -> &'static TypeInfo

source§

impl Typed for NonZeroI128
where Self: Any + Send + Sync,

source§

fn type_info() -> &'static TypeInfo

source§

impl Typed for NonZeroIsize
where Self: Any + Send + Sync,

source§

fn type_info() -> &'static TypeInfo

source§

impl Typed for NonZeroU8
where Self: Any + Send + Sync,

source§

fn type_info() -> &'static TypeInfo

source§

impl Typed for NonZeroU16
where Self: Any + Send + Sync,

source§

fn type_info() -> &'static TypeInfo

source§

impl Typed for NonZeroU32
where Self: Any + Send + Sync,

source§

fn type_info() -> &'static TypeInfo

source§

impl Typed for NonZeroU64
where Self: Any + Send + Sync,

source§

fn type_info() -> &'static TypeInfo

source§

impl Typed for NonZeroU128
where Self: Any + Send + Sync,

source§

fn type_info() -> &'static TypeInfo

source§

impl Typed for NonZeroUsize
where Self: Any + Send + Sync,

source§

fn type_info() -> &'static TypeInfo

source§

impl<A: Reflect + TypePath + GetTypeRegistration> Typed for (A,)

source§

fn type_info() -> &'static TypeInfo

source§

impl<A: Reflect + TypePath + GetTypeRegistration, B: Reflect + TypePath + GetTypeRegistration> Typed for (A, B)

source§

fn type_info() -> &'static TypeInfo

source§

impl<A: Reflect + TypePath + GetTypeRegistration, B: Reflect + TypePath + GetTypeRegistration, C: Reflect + TypePath + GetTypeRegistration> Typed for (A, B, C)

source§

fn type_info() -> &'static TypeInfo

source§

impl<A: Reflect + TypePath + GetTypeRegistration, B: Reflect + TypePath + GetTypeRegistration, C: Reflect + TypePath + GetTypeRegistration, D: Reflect + TypePath + GetTypeRegistration> Typed for (A, B, C, D)

source§

fn type_info() -> &'static TypeInfo

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)

source§

fn type_info() -> &'static TypeInfo

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)

source§

fn type_info() -> &'static TypeInfo

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)

source§

fn type_info() -> &'static TypeInfo

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)

source§

fn type_info() -> &'static TypeInfo

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)

source§

fn type_info() -> &'static TypeInfo

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)

source§

fn type_info() -> &'static TypeInfo

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)

source§

fn type_info() -> &'static TypeInfo

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)

source§

fn type_info() -> &'static TypeInfo

source§

impl<K, V> Typed for BTreeMap<K, V>

source§

fn type_info() -> &'static TypeInfo

source§

impl<K, V, S> Typed for HashMap<K, V, S>

source§

fn type_info() -> &'static TypeInfo

source§

impl<K, V, S> Typed for HashMap<K, V, S>

source§

fn type_info() -> &'static TypeInfo

source§

impl<N, E, Ix> Typed for DiGraph<N, E, Ix>
where Self: Any + Send + Sync, N: TypePath + Clone, E: TypePath + Clone, Ix: TypePath + IndexType,

Available on crate feature petgraph only.
source§

fn type_info() -> &'static TypeInfo

source§

impl<T> Typed for Option<T>
where Self: Any + Send + Sync, T: TypePath + FromReflect + RegisterForReflection,

source§

fn type_info() -> &'static TypeInfo

source§

impl<T> Typed for BinaryHeap<T>
where Self: Any + Send + Sync, T: TypePath + Clone,

source§

fn type_info() -> &'static TypeInfo

source§

impl<T> Typed for BTreeSet<T>
where Self: Any + Send + Sync, T: TypePath + Ord + Eq + Clone + Send + Sync,

source§

fn type_info() -> &'static TypeInfo

source§

impl<T> Typed for Arc<T>
where Self: Any + Send + Sync, T: TypePath + Send + Sync,

source§

fn type_info() -> &'static TypeInfo

source§

impl<T> Typed for Saturating<T>
where Self: Any + Send + Sync, T: TypePath + Clone + Send + Sync,

source§

fn type_info() -> &'static TypeInfo

source§

impl<T> Typed for Wrapping<T>
where Self: Any + Send + Sync, T: TypePath + Clone + Send + Sync,

source§

fn type_info() -> &'static TypeInfo

source§

impl<T> Typed for Range<T>
where Self: Any + Send + Sync, T: TypePath + Clone + Send + Sync,

source§

fn type_info() -> &'static TypeInfo

source§

impl<T> Typed for RangeFrom<T>
where Self: Any + Send + Sync, T: TypePath + Clone + Send + Sync,

source§

fn type_info() -> &'static TypeInfo

source§

impl<T> Typed for RangeInclusive<T>
where Self: Any + Send + Sync, T: TypePath + Clone + Send + Sync,

source§

fn type_info() -> &'static TypeInfo

source§

impl<T> Typed for RangeTo<T>
where Self: Any + Send + Sync, T: TypePath + Clone + Send + Sync,

source§

fn type_info() -> &'static TypeInfo

source§

impl<T> Typed for RangeToInclusive<T>
where Self: Any + Send + Sync, T: TypePath + Clone + Send + Sync,

source§

fn type_info() -> &'static TypeInfo

source§

impl<T, E> Typed for Result<T, E>
where Self: Any + Send + Sync, T: TypePath + FromReflect + RegisterForReflection, E: TypePath + FromReflect + RegisterForReflection,

source§

fn type_info() -> &'static TypeInfo

source§

impl<T, S> Typed for HashSet<T, S>
where Self: Any + Send + Sync, T: TypePath + Hash + Eq + Clone + Send + Sync, S: TypePath + TypePath + Clone + Send + Sync,

source§

fn type_info() -> &'static TypeInfo

source§

impl<T, S> Typed for HashSet<T, S>
where Self: Any + Send + Sync, T: TypePath + Hash + Eq + Clone + Send + Sync, S: TypePath + TypePath + Clone + Send + Sync,

source§

fn type_info() -> &'static TypeInfo

source§

impl<T: Array + TypePath + Send + Sync + 'static> Typed for SmallVec<T>

Available on crate feature smallvec only.
source§

fn type_info() -> &'static TypeInfo

source§

impl<T: FromReflect + Clone + TypePath + GetTypeRegistration> Typed for Cow<'static, [T]>

source§

fn type_info() -> &'static TypeInfo

source§

impl<T: FromReflect + TypePath + GetTypeRegistration> Typed for VecDeque<T>

source§

fn type_info() -> &'static TypeInfo

source§

impl<T: FromReflect + TypePath + GetTypeRegistration> Typed for Vec<T>

source§

fn type_info() -> &'static TypeInfo

source§

impl<T: Reflect + TypePath + GetTypeRegistration, const N: usize> Typed for [T; N]

source§

fn type_info() -> &'static TypeInfo

Implementors§

source§

impl Typed for dyn Reflect