-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Open
Labels
A-ECSEntities, components, systems, and eventsEntities, components, systems, and eventsC-Code-QualityA section of code that is hard to understand or changeA section of code that is hard to understand or changeC-PerformanceA change motivated by improving speed, memory usage or compile timesA change motivated by improving speed, memory usage or compile timesD-StraightforwardSimple bug fixes and API improvements, docs, test and examplesSimple bug fixes and API improvements, docs, test and examplesS-BlockedThis cannot move forward until something else changesThis cannot move forward until something else changes
Description
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 and Resource 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.
- trait bounds other than
Sizedon const fn parameters are unstable std::any::type_nameis not yet stable as a const fnTypeId::ofis not yet stable as a const fn- function pointer casts are not allowed in constant functions
rust-lang/rust#57563 is the relevant tracking issue
Metadata
Metadata
Assignees
Labels
A-ECSEntities, components, systems, and eventsEntities, components, systems, and eventsC-Code-QualityA section of code that is hard to understand or changeA section of code that is hard to understand or changeC-PerformanceA change motivated by improving speed, memory usage or compile timesA change motivated by improving speed, memory usage or compile timesD-StraightforwardSimple bug fixes and API improvements, docs, test and examplesSimple bug fixes and API improvements, docs, test and examplesS-BlockedThis cannot move forward until something else changesThis cannot move forward until something else changes