bevy/crates/bevy_reflect/derive/src/impls
Gino Valente faf003fc9d
bevy_reflect: enum_utility cleanup (#13424)
# Objective

The `enum_utility` module contains the `get_variant_constructors`
function, which is used to generate token streams for constructing
enums. It's used for the `FromReflect::from_reflect` implementation and
the `Reflect::try_apply` implementation.

Due to the complexity of enums, this function is understandably a little
messy and difficult to extend.

## Solution

Clean up the `enum_utility` module.

Now "clean" is a bit subjective. I believe my solution is "cleaner" in
that the logic to generate the tokens are strictly coupled with the
intended usage. Because of this, `try_apply` is also no longer strictly
coupled with `from_reflect`.

This makes it easier to extend with new functionality, which is
something I'm doing in a future unrelated PR that I have based off this
one.

## Testing

There shouldn't be any testing required other than ensuring that the
project still builds and that CI passes.
2024-05-22 21:18:57 +00:00
..
enums.rs bevy_reflect: enum_utility cleanup (#13424) 2024-05-22 21:18:57 +00:00
mod.rs Rename bevy_reflect_derive folder to derive (#13269) 2024-05-07 07:55:32 +00:00
structs.rs bevy_reflect: Custom attributes (#11659) 2024-05-20 19:30:21 +00:00
tuple_structs.rs bevy_reflect: Custom attributes (#11659) 2024-05-20 19:30:21 +00:00
typed.rs Rename bevy_reflect_derive folder to derive (#13269) 2024-05-07 07:55:32 +00:00
values.rs Finish the work on try_apply (#12646) 2024-05-08 14:26:01 +00:00