bevy/crates/bevy_reflect/derive/src
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
..
impls bevy_reflect: enum_utility cleanup (#13424) 2024-05-22 21:18:57 +00:00
container_attributes.rs bevy_reflect: Custom attributes (#11659) 2024-05-20 19:30:21 +00:00
custom_attributes.rs bevy_reflect: Custom attributes (#11659) 2024-05-20 19:30:21 +00:00
derive_data.rs bevy_reflect: Custom attributes (#11659) 2024-05-20 19:30:21 +00:00
documentation.rs Rename bevy_reflect_derive folder to derive (#13269) 2024-05-07 07:55:32 +00:00
enum_utility.rs bevy_reflect: enum_utility cleanup (#13424) 2024-05-22 21:18:57 +00:00
field_attributes.rs bevy_reflect: Custom attributes (#11659) 2024-05-20 19:30:21 +00:00
from_reflect.rs bevy_reflect: enum_utility cleanup (#13424) 2024-05-22 21:18:57 +00:00
lib.rs bevy_reflect: Custom attributes (#11659) 2024-05-20 19:30:21 +00:00
reflect_value.rs bevy_reflect: Remove ContainerAttributes::merge (#13303) 2024-05-09 18:17:54 +00:00
registration.rs Rename bevy_reflect_derive folder to derive (#13269) 2024-05-07 07:55:32 +00:00
serialization.rs Rename bevy_reflect_derive folder to derive (#13269) 2024-05-07 07:55:32 +00:00
trait_reflection.rs Rename bevy_reflect_derive folder to derive (#13269) 2024-05-07 07:55:32 +00:00
type_path.rs Rename bevy_reflect_derive folder to derive (#13269) 2024-05-07 07:55:32 +00:00
utility.rs Rename bevy_reflect_derive folder to derive (#13269) 2024-05-07 07:55:32 +00:00