-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
[Merged by Bors] - impl Reflect
for &'static Path
#6755
Conversation
@@ -1019,6 +1100,27 @@ impl FromReflect for Cow<'static, str> { | |||
} | |||
} | |||
|
|||
impl Typed for &'static Path { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are these impls separated from the Reflect
impl?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No particular reason, I just copied how the other impls in the file are organized.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh lol looks like I someone messed up in placing the Option<T>
impls 🤦
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's fine to leave it for now. I'll follow up with a quick cleanup PR!
impl GetTypeRegistration for &'static Path { | ||
fn get_type_registration() -> TypeRegistration { | ||
let mut registration = TypeRegistration::of::<Self>(); | ||
registration.insert::<ReflectFromPtr>(FromType::<Self>::from_type()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are there other registrations we should include here? I think we could do ReflectSerialize
but I'm not sure ReflectDeserialize
is possible for a reference (?) so maybe we shouldn't include either? 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm, I don't think there is anything else to register apart from those. So this is probably fine.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might make more sense to support serialization for Cow<'static, Path>
instead.
bors try |
tryBuild failed: |
bors r+ |
Reflect
for &'static Path
Reflect
for &'static Path
# Objective > Followup to [this](#6755 (comment)) comment Rearrange the impls in the `impls/std.rs` file. The issue was that I had accidentally misplaced the impl for `Option<T>` and put it between the `Cow<'static, str>` impls. This is just a slight annoyance and readability issue. ## Solution Move the `Option<T>` and `&'static Path` impls around to be more readable.
# Objective > Followup to [this](bevyengine#6755 (comment)) comment Rearrange the impls in the `impls/std.rs` file. The issue was that I had accidentally misplaced the impl for `Option<T>` and put it between the `Cow<'static, str>` impls. This is just a slight annoyance and readability issue. ## Solution Move the `Option<T>` and `&'static Path` impls around to be more readable.
# Objective > Followup to [this](bevyengine#6755 (comment)) comment Rearrange the impls in the `impls/std.rs` file. The issue was that I had accidentally misplaced the impl for `Option<T>` and put it between the `Cow<'static, str>` impls. This is just a slight annoyance and readability issue. ## Solution Move the `Option<T>` and `&'static Path` impls around to be more readable.
# Objective Fixes bevyengine#6739 ## Solution Implement the required traits. They cannot be implemented for `Path` directly, since it is a dynamically-sized type.
# Objective > Followup to [this](bevyengine#6755 (comment)) comment Rearrange the impls in the `impls/std.rs` file. The issue was that I had accidentally misplaced the impl for `Option<T>` and put it between the `Cow<'static, str>` impls. This is just a slight annoyance and readability issue. ## Solution Move the `Option<T>` and `&'static Path` impls around to be more readable.
Objective
Fixes #6739
Solution
Implement the required traits. They cannot be implemented for
Path
directly, since it is a dynamically-sized type.