Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

reflect: remove manual Reflect impls which could be handled by macros #12025

Closed
wants to merge 3 commits into from

Conversation

soqb
Copy link
Contributor

@soqb soqb commented Feb 21, 2024

Objective

  • In some cases we used manual impls for certain types, though they are (at least, now) unnecessary.

Solution

@soqb soqb added C-Code-Quality A section of code that is hard to understand or change A-Reflection Runtime information about types labels Feb 21, 2024
Copy link
Member

@MrGVSV MrGVSV left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Amazing! Just one comment (and one non-blocking question)

@@ -52,7 +47,8 @@ use thiserror::Error;
/// This means that the common case of `asset_server.load("my_scene.scn")` when it creates and
/// clones internal owned [`AssetPaths`](AssetPath).
/// This also means that you should use [`AssetPath::parse`] in cases where `&str` is the explicit type.
#[derive(Eq, PartialEq, Hash, Clone, Default)]
#[derive(Eq, PartialEq, Hash, Clone, Default, Reflect)]
#[reflect_value(Debug, PartialEq, Hash, Serialize, Deserialize)]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't have to update it in this PR, but any reason why this is a reflect_value type? I would have assumed CowArc would be reflectable, but maybe not?

crates/bevy_render/src/render_asset.rs Show resolved Hide resolved
Copy link
Member

@james7132 james7132 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM sans @MrGVSV's comments.

Co-authored-by: James Liu <contact@jamessliu.com>
@alice-i-cecile alice-i-cecile added the S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it label Mar 10, 2024
@@ -67,7 +63,9 @@ bitflags::bitflags! {
/// If you have an asset that doesn't actually need to end up in the render world, like an Image
/// that will be decoded into another Image asset, use `MAIN_WORLD` only.
#[repr(transparent)]
#[derive(Serialize, TypePath, Deserialize, Hash, Clone, Copy, PartialEq, Eq, Debug)]
#[derive(Serialize, Deserialize, Hash, Clone, Copy, PartialEq, Eq, Debug, Reflect)]
#[reflect(Serialize, Deserialize, Hash, PartialEq, Debug, Reflect)]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How is CI passing if we never import ReflectSerialize et al? 🤔

@alice-i-cecile
Copy link
Member

@soqb can you resolve merge conflicts? They're not trivial so I'm not going to tackle them in the web client.

@soqb
Copy link
Contributor Author

soqb commented Mar 12, 2024

not this week i'm afraid, but i do plan on it when there's time.

@alice-i-cecile alice-i-cecile added the S-Adopt-Me The original PR author has no intent to complete this work. Pick me up! label Mar 18, 2024
@OneFourth
Copy link
Contributor

I'm interested in adopting this PR, I think I can fix the merge conflicts at least

github-merge-queue bot pushed a commit that referenced this pull request Mar 23, 2024
…#12596)

# Objective

* Adopted #12025 to fix merge conflicts
* In some cases we used manual impls for certain types, though they are
(at least, now) unnecessary.

## Solution

* Use macros and reflecting-by-value to avoid this clutter.
* Though there were linker issues with Reflect and the CowArc in
AssetPath (see #9747), I
checked these are resolved by using #[reflect_value].

---------

Co-authored-by: soqb <cb.setho@gmail.com>
Co-authored-by: Alice Cecile <alice.i.cecile@gmail.com>
Co-authored-by: James Liu <contact@jamessliu.com>
@soqb soqb closed this Aug 3, 2024
@soqb soqb deleted the ungoof-reflect-5 branch August 3, 2024 10:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Reflection Runtime information about types C-Code-Quality A section of code that is hard to understand or change S-Adopt-Me The original PR author has no intent to complete this work. Pick me up! S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants