-
-
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
Add Reflection for Wrapping/Saturating types #11397
Conversation
Welcome, new contributor! Please make sure you've read our contributing guide and we look forward to reviewing your pull request shortly ✨ |
impl_reflect_value!(::core::num::Wrapping<T: Clone + Send + Sync>()); | ||
impl_reflect_value!(::core::num::Saturating<T: Clone + Send + Sync>()); |
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.
Nit: It might be nice to add a test for these since derives on generics can be a bit wonky haha. Not required though since I believe other reflect_value generics are tested
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.
You can use static_assertions
similar to how it was used #11407. Check out the assert_impl_all
macro.
LGTM! We could consider forcing additional bounds (i.e. |
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.
Please fill out the full PR description template. We use tools to build our changelogs and migration guides from them. No migration guide is needed here, but the changelog should be appropriately filled out.
Done. |
Objective
Wrapping
andSaturating
generic types.This wasn't my use-case but someone in the discord was surprised that this wasn't already done. I decided to make a PR because the other
std::num
items were reflected and if there's a reason to excludeWrapping
andSaturating
, I am unaware of it.Solution
Trivial fix
Changelog
Implemented
Reflect
forWrapping<T>
andSaturating<T>
fromstd::num
.