forked from bevyengine/bevy
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add const to methods and const defaults to bevy_ui (bevyengine#5542)
# Objective - Fixes bevyengine#5529 ## Solution - Add assosciated constants named DEFAULT to as many types as possible - Add const to as many methods in bevy_ui as possible I have not applied the same treatment to the bundles in bevy_ui as it would require going into other bevy crates to implement const defaults for structs in bevy_text or relies on UiImage which calls HandleUntyped.typed() which isn't const safe. Alternatively the defaults could relatively easily be turned into a macro to regain some of the readability and conciseness at the cost of explicitness. Such a macro that partially implements this exists as a crate here: [const-default](https://docs.rs/const-default/latest/const_default/derive.ConstDefault.html) but does not support enums. Let me know if there's anything I've missed or if I should push further into other crates. Co-authored-by: Carter Anderson <mcanders1@gmail.com>
- Loading branch information
Showing
3 changed files
with
238 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.