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
FromReflectimplementation forOption<PathBuf>could not take aStringand 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
FromReflectderive macro get a new argument to the attribute helper to tell it to try using theFromtrait (or a user-provided conversion).It would look something like this:
With this in place, the implementations of
FromReflectthat are provided bybevyitself for types fromstdand 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 thatTis a generic param of the type. I further propose adding aNulltype to the crate as a placeholder forOption::None.Beta Was this translation helpful? Give feedback.
All reactions