Skip to main content

Module reflect

Module reflect 

Source
Expand description

Runtime reflection helpers built on top of bevy_reflect.

Modules§

access
Representation for individual element accesses within a path.
attributes
Types and functions for creating, manipulating and querying CustomAttributes.
erased_serde
githubcrates-iodocs-rs
prelude
The reflect prelude.
serde
Serde integration for reflected types.
std_traits
Module containing the ReflectDefault type.
utility
Helpers for working with Bevy reflection.

Macros§

hash_error
Used to produce an error message when an attempt is made to hash a PartialReflect value that does not support hashing.
impl_from_reflect_opaque
A macro used to generate a FromReflect trait implementation for the given type.
impl_reflect
A replacement for #[derive(Reflect)] to be used with foreign types which the definitions of cannot be altered.
impl_reflect_opaque
A macro used to generate reflection trait implementations for the given type.
impl_type_path
A replacement for deriving TypePath for use on foreign types.
load_type_registrations
Collects and loads type registrations when using auto_register_static feature.

Structs§

AccessError
An error originating from an Access of an element within a type.
ArrayInfo
A container for compile-time array info.
ArrayIter
An iterator over an Array.
ConstParamInfo
Type information for a const generic parameter.
DynamicArray
A fixed-size list of reflected values.
DynamicEnum
A dynamic representation of an enum.
DynamicList
A list of reflected values.
DynamicMap
An unordered mapping between reflected values.
DynamicSet
An unordered set of reflected values.
DynamicStruct
A struct type which allows fields to be added at runtime.
DynamicTuple
A tuple which allows fields to be added at runtime.
DynamicTupleStruct
A tuple struct which allows fields to be added at runtime.
EnumInfo
A container for compile-time enum info, used by TypeInfo.
FieldIter
An iterator over the field values of a struct.
Generics
The generic parameters of a type.
ListInfo
A container for compile-time list info.
ListIter
An iterator over an List.
MapInfo
A container for compile-time map info.
NamedField
The named field of a reflected struct.
OffsetAccess
An Access combined with an offset for more helpful error reporting.
OpaqueInfo
A container for compile-time info related to reflection-opaque types, including primitives.
ParseError
An error that occurs when parsing reflect path strings.
ParsedPath
A pre-parsed path to an element within a type.
ReflectDeserialize
A struct used to deserialize reflected instances of a type.
ReflectFromPtr
Reflect values are commonly used in situations where the actual types of values are not known at runtime. In such situations you might have access to a *const () pointer that you know implements Reflect, but have no way of turning it into a &dyn Reflect.
ReflectFromReflect
Type data that represents the FromReflect trait and allows it to be used dynamically.
ReflectKindMismatchError
Caused when a type was expected to be of a certain kind, but was not.
ReflectSerialize
A struct used to serialize reflected instances of a type.
SetInfo
A container for compile-time set info.
StructInfo
A container for compile-time named struct info.
StructVariantInfo
Type info for struct variants.
TupleFieldIter
An iterator over the field values of a tuple.
TupleInfo
A container for compile-time tuple info.
TupleStructFieldIter
An iterator over the field values of a tuple struct.
TupleStructInfo
A container for compile-time tuple struct info.
TupleVariantInfo
Type info for tuple variants.
Type
The base representation of a Rust type.
TypeParamInfo
Type information for a generic type parameter.
TypePathTable
Provides dynamic access to all methods on TypePath.
TypeRegistration
Runtime storage for type metadata, registered into the TypeRegistry.
TypeRegistry
A registry of reflected types.
TypeRegistryArc
A synchronized wrapper around a TypeRegistry.
UnitVariantInfo
Type info for unit variants.
UnnamedField
The unnamed field of a reflected tuple or tuple struct.
VariantFieldIter
An iterator over the fields in the current enum variant.

Enums§

Access
A singular element access within a path. Multiple accesses can be combined into a ParsedPath.
AccessErrorKind
The kind of AccessError, along with some kind-specific information.
ApplyError
A enumeration of all error outcomes that might happen when running try_apply.
DynamicVariant
A dynamic representation of an enum variant.
FieldId
A representation of a field’s accessor.
GenericInfo
An enum representing a generic parameter.
ReflectCloneError
An error that occurs when cloning a type via PartialReflect::reflect_clone.
ReflectKind
An enumeration of the “kinds” of a reflected type.
ReflectMut
A mutable enumeration of “kinds” of a reflected type.
ReflectOwned
An owned enumeration of “kinds” of a reflected type.
ReflectPathError
An error returned from a failed path string query.
ReflectRef
An immutable enumeration of “kinds” of a reflected type.
TypeInfo
Compile-time type information for various reflected types.
TypeInfoError
A TypeInfo-specific error.
VariantField
A field in the current enum variant.
VariantInfo
A container for compile-time enum variant info.
VariantInfoError
A VariantInfo-specific error.
VariantType
Describes the form of an enum variant.

Traits§

Array
A trait used to power array-like operations via reflection.
DynamicTypePath
Dynamic dispatch for TypePath.
DynamicTyped
Dynamic dispatch for Typed.
Enum
A trait used to power enum-like operations via reflection.
FromReflect
A trait that enables types to be dynamically constructed from reflected data.
FromType
Trait used to generate TypeData for trait reflection.
GetField
A convenience trait which combines fetching and downcasting of struct fields.
GetPath
A trait which allows nested Reflect values to be retrieved with path strings.
GetTupleField
A convenience trait which combines fetching and downcasting of tuple fields.
GetTupleStructField
A convenience trait which combines fetching and downcasting of tuple struct fields.
GetTypeRegistration
A trait which allows a type to generate its TypeRegistration for registration into the TypeRegistry.
Is
Checks if the current type “is” another type, using a TypeId equality comparison.
List
A trait used to power list-like operations via reflection.
Map
A trait used to power map-like operations via reflection.
PartialReflect
The foundational trait of bevy_reflect, used for accessing and modifying data dynamically.
Reflect
A core trait of bevy_reflect, used for downcasting to concrete types.
ReflectPath
Something that can be interpreted as a reflection path in GetPath.
ReflectRemote
Marks a type as a reflectable wrapper for a remote type.
ReflectTaskIntrospection
Runtime task-reflect contract exposed by generated Copper applications.
ReflectTypePath
Reflectable
A catch-all trait that is bound by the core reflection traits, useful to simplify reflection-based generic type bounds.
Set
A trait used to power set-like operations via reflection.
Struct
A trait used to power struct-like operations via reflection.
Tuple
A trait used to power tuple-like operations via reflection.
TupleStruct
A trait used to power tuple struct-like operations via reflection.
TypeData
A trait used to type-erase type metadata.
TypePath
A static accessor to type paths and names.
Typed
A static accessor to compile-time type information.

Functions§

array_apply
Applies the reflected array data to the given array.
array_debug
The default debug formatter for Array types.
array_hash
Returns the u64 hash of the given array.
array_partial_eq
Compares two arrays (one concrete and one reflected) to see if they are equal.
array_try_apply
Tries to apply the reflected array data to the given array and returns a Result.
dump_type_registry_schema
Dumps a stable, human-readable schema snapshot for the registered reflected types.
enum_debug
The default debug formatter for Enum types.
enum_hash
Returns the u64 hash of the given enum.
enum_partial_eq
Compares an Enum with a PartialReflect value.
list_apply
Applies the elements of b to the corresponding elements of a.
list_debug
The default debug formatter for List types.
list_hash
Returns the u64 hash of the given list.
list_partial_eq
Compares a List with a Reflect value.
list_try_apply
Tries to apply the elements of b to the corresponding elements of a and returns a Result.
map_apply
Applies the elements of reflected map b to the corresponding elements of map a.
map_debug
The default debug formatter for Map types.
map_partial_eq
Compares a Map with a PartialReflect value.
map_try_apply
Tries to apply the elements of reflected map b to the corresponding elements of map a and returns a Result.
set_apply
Applies the elements of reflected set b to the corresponding elements of set a.
set_debug
The default debug formatter for Set types.
set_partial_eq
Compares a Set with a PartialReflect value.
set_try_apply
Tries to apply the elements of reflected set b to the corresponding elements of set a and returns a Result.
struct_debug
The default debug formatter for Struct types.
struct_partial_eq
Compares a Struct with a PartialReflect value.
tuple_apply
Applies the elements of b to the corresponding elements of a.
tuple_debug
The default debug formatter for Tuple types.
tuple_partial_eq
Compares a Tuple with a PartialReflect value.
tuple_struct_debug
The default debug formatter for TupleStruct types.
tuple_struct_partial_eq
Compares a TupleStruct with a PartialReflect value.
tuple_try_apply
Tries to apply the elements of b to the corresponding elements of a and returns a Result.

Attribute Macros§

reflect_remote
Generates a wrapper type that can be used to “derive Reflect” for remote types.
reflect_trait
A macro that automatically generates type data for traits, which their implementors can then register.

Derive Macros§

FromReflect
Derives the FromReflect trait.
Reflect
The main derive macro used by bevy_reflect for deriving its Reflect trait.
TypePath
Derives the TypePath trait, providing a stable alternative to [std::any::type_name].