bevy/crates/bevy_reflect/bevy_reflect_derive/src
Jakob Hellermann 7d9e864d9c implement Reflect for Input<T>, some misc improvements to reflect value derive (#5676)
# Objective

- I'm currently working on being able to call methods on reflect types (https://github.com/jakobhellermann/bevy_reflect_fns)
- for that, I'd like to add methods to the `Input<KeyCode>` resource (which I'm doing by registering type data)
- implementing `Reflect` is currently a requirement for having type data in the `TypeRegistry`

## Solution

- derive `Reflect` for `KeyCode` and `Input`
- uses `#[reflect_value]` for `Input`, since it's fields aren't supposed to be observable
- using reflect_value would need `Clone` bounds on `T`, but since all the methods (`.pressed` etc) already require `T: Copy`, I unified everything to requiring `Copy`
- add `Send + Sync + 'static` bounds, also required by reflect derive

## Unrelated improvements 
I can extract into a separate PR if needed.

- the `Reflect` derive would previously ignore `#[reflect_value]` and only accept `#[reflect_value()]` which was a bit confusing
- the generated code used `val.clone()` on a reference, which is fine if `val` impls `Clone`, but otherwise also compiles with a worse error message. Change to `std::clone::Clone::clone(val)` instead which gives a neat `T does not implement Clone` error
2022-09-07 15:59:50 +00:00
..
impls implement Reflect for Input<T>, some misc improvements to reflect value derive (#5676) 2022-09-07 15:59:50 +00:00
container_attributes.rs bevy_reflect: Reflect enums (#4761) 2022-08-02 22:14:41 +00:00
derive_data.rs implement Reflect for Input<T>, some misc improvements to reflect value derive (#5676) 2022-09-07 15:59:50 +00:00
enum_utility.rs bevy_reflect: Reflect enums (#4761) 2022-08-02 22:14:41 +00:00
field_attributes.rs Update codebase to use IntoIterator where possible. (#5269) 2022-07-11 15:28:50 +00:00
from_reflect.rs bevy_reflect: Reflect enums (#4761) 2022-08-02 22:14:41 +00:00
lib.rs bevy_reflect: Reflect enums (#4761) 2022-08-02 22:14:41 +00:00
reflect_value.rs bevy_reflect_derive: Tidying up the code (#4712) 2022-05-12 19:43:23 +00:00
registration.rs bevy_reflect: ReflectFromPtr to create &dyn Reflect from a *const () (#4475) 2022-07-19 23:00:34 +00:00
trait_reflection.rs bevy_reflect: Added get_boxed method to reflect_trait (#4120) 2022-05-20 13:31:49 +00:00
type_uuid.rs Clippy improvements (#4665) 2022-05-31 01:38:07 +00:00
utility.rs bevy_reflect: Reflect enums (#4761) 2022-08-02 22:14:41 +00:00