bevy/crates/bevy_reflect/src
Jakob Hellermann 3d36ec41dc re-enable #[derive(TypeUuid)] for generics (#4118)
Support for deriving `TypeUuid` for types with generics was initially added in https://github.com/bevyengine/bevy/pull/2044 but later reverted https://github.com/bevyengine/bevy/pull/2204 because it lead to `MyStruct<A>` and `MyStruct<B>` having the same type uuid.

This PR fixes this by generating code like
```rust
#[derive(TypeUuid)]
#[uuid = "69b09733-a21a-4dab-a444-d472986bd672"]
struct Type<T>(T);

impl<T: TypeUuid> TypeUuid for Type<T> {
  const TYPE_UUID: TypeUuid = generate_compound_uuid(Uuid::from_bytes([/* 69b0 uuid */]), T::TYPE_UUID);
}
```

where `generate_compound_uuid` will XOR the non-metadata bits of the two UUIDs.

Co-authored-by: XBagon <xbagon@outlook.de>
Co-authored-by: Jakob Hellermann <hellermann@sipgate.de>
2022-04-26 19:41:25 +00:00
..
impls bevy_reflect: Add as_reflect and as_reflect_mut (#4350) 2022-04-25 13:54:48 +00:00
serde Avoid some format! into immediate format! (#2913) 2021-10-06 18:34:33 +00:00
lib.rs re-enable #[derive(TypeUuid)] for generics (#4118) 2022-04-26 19:41:25 +00:00
list.rs bevy_reflect: IntoIter for DynamicList and DynamicMap (#4108) 2022-04-26 00:17:38 +00:00
map.rs bevy_reflect: IntoIter for DynamicList and DynamicMap (#4108) 2022-04-26 00:17:38 +00:00
path.rs document more of bevy_reflect (#3655) 2022-01-14 19:09:44 +00:00
reflect.rs bevy_reflect: Add as_reflect and as_reflect_mut (#4350) 2022-04-25 13:54:48 +00:00
struct_trait.rs bevy_reflect: Add as_reflect and as_reflect_mut (#4350) 2022-04-25 13:54:48 +00:00
tuple_struct.rs bevy_reflect: Add as_reflect and as_reflect_mut (#4350) 2022-04-25 13:54:48 +00:00
tuple.rs bevy_reflect: Add as_reflect and as_reflect_mut (#4350) 2022-04-25 13:54:48 +00:00
type_registry.rs Re-enable test_property_type_registration() (#4419) 2022-04-05 18:34:27 +00:00
type_uuid.rs re-enable #[derive(TypeUuid)] for generics (#4118) 2022-04-26 19:41:25 +00:00