Make ComponentDescriptor const #3365
Labels
A-ECS
Entities, components, systems, and events
C-Code-Quality
A section of code that is hard to understand or change
C-Performance
A change motivated by improving speed, memory usage or compile times
D-Straightforward
Simple bug fixes and API improvements, docs, test and examples
S-Blocked
This cannot move forward until something else changes
What problem does this solve or what need does it fill?
The
ComponentDescriptor
is always the same for each component type.What solution would you like?
Create an associated constant on the
Component
andResource
trait, which stores the existing information.Constify all of the methods on
ComponentDescriptor
, then use those to initialize this information at compile-time.We can also do this for
NonSend
resources by creating a simple trait for them.What alternative(s) have you considered?
Enable the feature flags and do it now!
Additional context
This is blocked by several (!) unstable
rustc
features.Sized
on const fn parameters are unstablestd::any::type_name
is not yet stable as a const fnTypeId::of
is not yet stable as a const fnrust-lang/rust#57563 is the relevant tracking issue
The text was updated successfully, but these errors were encountered: