-
-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
Implement Reflect for Result<T, E> as enum #13182
Implement Reflect for Result<T, E> as enum #13182
Conversation
Signed-off-by: Marcel Müller <neikos@neikos.email>
882db50
to
5a9f579
Compare
It looks like your PR is a breaking change, but you didn't provide a migration guide. Could you add some context on what users should update when this change get released in a new version of Bevy? |
thanks for getting round to this! LGTM: implementation is correct and in the right place, and i am hugely on board with the semantic improvement. this is a subtle breaking change (beyond the acknowledged |
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.
LGTM!
I agree that a Migration Guide should be added, though.
Objective
Result<T, E>
implement Reflect such that it is an Enum rather than a ValueSolution
Testing
I tried it out locally, and it does what it says on the tin. Not sure how to test it in context of the crate?
Changelog
Changed
ReflectKind::Enum
rather thanReflectKind::Value
, allowing for inspection of its constituentsMigration Guide
Result<T, E>
has had itsReflect
implementation changed to align it withOption<T>
and its intended semantics: A carrier of either anOk
orErr
value, and the ability to access it. To achieve this it is no longer aReflectKind::Value
but rather aReflectKind::Enum
and as such carries these changes with it:For
Result<T, E>
T
andE
no longer require to beClone
and now require to beFromReflect
<Result<T, E> as Reflect>::reflect_*
now returns aReflectKind::Enum
, so any code that previously relied on it being aValue
kind will have to be adapted.Result<T, E>
now implementsEnum
Since the migration is highly dependent on the previous usage, no automatic upgrade path can be given.