bevy/crates/bevy_ui/src
James O'Brien df3673f679 Add const to methods and const defaults to bevy_ui (#5542)
# Objective
- Fixes #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>
2023-01-04 19:58:09 +00:00
..
flex Upgrade to Taffy 0.2 (#6743) 2022-12-21 02:15:53 +00:00
render Flatten render commands (#6885) 2023-01-04 01:13:30 +00:00
widget text aspect ratio bug fix (#6825) 2022-12-20 16:44:12 +00:00
camera_config.rs Fix UiCameraConfig doc (link to the Camera page) (#6969) 2022-12-20 23:32:04 +00:00
focus.rs Add const to methods and const defaults to bevy_ui (#5542) 2023-01-04 19:58:09 +00:00
geometry.rs Add const to methods and const defaults to bevy_ui (#5542) 2023-01-04 19:58:09 +00:00
lib.rs Remove ImageMode (#6674) 2022-11-18 21:16:32 +00:00
node_bundles.rs Remove needless manual default impl of ButtonBundle (#6970) 2022-12-20 16:17:14 +00:00
stack.rs Add z-index support with a predictable UI stack (#5877) 2022-11-02 22:06:04 +00:00
ui_node.rs Add const to methods and const defaults to bevy_ui (#5542) 2023-01-04 19:58:09 +00:00
update.rs Add z-index support with a predictable UI stack (#5877) 2022-11-02 22:06:04 +00:00