-
-
Notifications
You must be signed in to change notification settings - Fork 23
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
Feature suggestion: assert_{lt,gt,le,ge}_size #18
Comments
You can already do that with use std::mem::size_of;
const_assert!(size_of::<u8>() <= size_of::<u16>()); Your proposed implementation wouldn't provide a better/specialized error message, so I don't see why a separate macro for this would be useful. |
Here's a macro with a better error message for asserting types are equal:
Before:
After:
(this macro is from |
This would be handy for example to ensure struct sizes don't grow beyond some limit.
It can be implemented like this:
The text was updated successfully, but these errors were encountered: