Replies: 2 comments 1 reply
-
I like it! Your first example seems to be a little off though since the conversion actually happens on Just a few more comments:
|
Beta Was this translation helpful? Give feedback.
1 reply
-
I think we may also need to update the derived implementations of |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I found it somewhat surprising that the
FromReflect
implementation forOption<PathBuf>
could not take aString
and convert it. After digging around a bit, it seems that there is no attempt to perform any conversion at all, and I could not see any obvious way to make it convert.I propose that the
FromReflect
derive macro get a new argument to the attribute helper to tell it to try using theFrom
trait (or a user-provided conversion).It would look something like this:
With this in place, the implementations of
FromReflect
that are provided bybevy
itself for types fromstd
and other crates can take advantage of the existing conversions to be more robust.The implementation for
Option<T>
can now be updated to accept an instance ofT
. One possible syntax for that can be#[reflect(from(<T>))]
to indicate thatT
is a generic param of the type. I further propose adding aNull
type to the crate as a placeholder forOption::None
.Beta Was this translation helpful? Give feedback.
All reactions