Enum bevy_internal::reflect::TypeInfo
source · pub enum TypeInfo {
Struct(StructInfo),
TupleStruct(TupleStructInfo),
Tuple(TupleInfo),
List(ListInfo),
Array(ArrayInfo),
Map(MapInfo),
Enum(EnumInfo),
Value(ValueInfo),
}
Expand description
Compile-time type information for various reflected types.
Generally, for any given type, this value can be retrieved one of three ways:
Each return a static reference to TypeInfo
, but they all have their own use cases.
For example, if you know the type at compile time, Typed::type_info
is probably
the simplest. If all you have is a dyn Reflect
, you’ll probably want Reflect::get_represented_type_info
.
Lastly, if all you have is a TypeId
or type path, you will need to go through
TypeRegistry::get_type_info
.
You may also opt to use TypeRegistry::get_type_info
in place of the other methods simply because
it can be more performant. This is because those other methods may require attaining a lock on
the static TypeInfo
, while the registry simply checks a map.
Variants§
Struct(StructInfo)
TupleStruct(TupleStructInfo)
Tuple(TupleInfo)
List(ListInfo)
Array(ArrayInfo)
Map(MapInfo)
Enum(EnumInfo)
Value(ValueInfo)
Implementations§
source§impl TypeInfo
impl TypeInfo
sourcepub fn type_path_table(&self) -> &TypePathTable
pub fn type_path_table(&self) -> &TypePathTable
A representation of the type path of the underlying type.
Provides dynamic access to all methods on TypePath
.
sourcepub fn type_path(&self) -> &'static str
pub fn type_path(&self) -> &'static str
The stable, full type path of the underlying type.
Use type_path_table
if you need access to the other methods on TypePath
.
Trait Implementations§
Auto Trait Implementations§
impl RefUnwindSafe for TypeInfo
impl Send for TypeInfo
impl Sync for TypeInfo
impl Unpin for TypeInfo
impl UnwindSafe for TypeInfo
Blanket Implementations§
source§impl<T, U> AsBindGroupShaderType<U> for T
impl<T, U> AsBindGroupShaderType<U> for T
source§fn as_bind_group_shader_type(&self, _images: &RenderAssets<Image>) -> U
fn as_bind_group_shader_type(&self, _images: &RenderAssets<Image>) -> U
T
ShaderType
for self
. When used in AsBindGroup
derives, it is safe to assume that all images in self
exist.source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.