-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Closed
Labels
A-UIGraphical user interfaces, styles, layouts, and widgetsGraphical user interfaces, styles, layouts, and widgetsC-UsabilityA targeted quality-of-life change that makes Bevy easier to useA targeted quality-of-life change that makes Bevy easier to useD-TrivialNice and easy! A great choice to get started with BevyNice and easy! A great choice to get started with Bevy
Description
What problem does this solve or what need does it fill?
Constants are useful when manually defining UIs to get compile-time guarantees that your style / layout won't unexpectedly change at runtime.
However, many of the existing builder methods are not const, when they could be.
What solution would you like?
- Look through
bevy_ui, and make any methods that you canconst. This is particularly important for methods that return a new struct of the type that the impl block is for (a "builder method"). - Ensure that all of the essential structs have a const equivalent to
Default::default(). This should be aDEFAULTassociated constant. Use these new constants in thedefaulttrait implementations where feasible.
What alternative(s) have you considered?
Use a const fn new(). This is less clear, doesn't display the actual value in docs, and may have indirection overhead (IIRC this varies based on the optimization level). These are simple values, they should be represented as such.
Metadata
Metadata
Assignees
Labels
A-UIGraphical user interfaces, styles, layouts, and widgetsGraphical user interfaces, styles, layouts, and widgetsC-UsabilityA targeted quality-of-life change that makes Bevy easier to useA targeted quality-of-life change that makes Bevy easier to useD-TrivialNice and easy! A great choice to get started with BevyNice and easy! A great choice to get started with Bevy
Type
Projects
Status
Done