-
Notifications
You must be signed in to change notification settings - Fork 139
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 support for bytemuck #336
Conversation
cc @MarijnS95 do these look right to you? I haven't used |
@@ -408,12 +409,6 @@ pub mod __private { | |||
pub use crate::{external::*, traits::*}; | |||
|
|||
pub use core; | |||
|
|||
#[cfg(feature = "serde")] | |||
pub use serde; |
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.
These have moved into the external
module alongside their supporting code
@@ -14,7 +14,7 @@ macro_rules! __declare_public_bitflags { | |||
$vis:vis struct $BitFlags:ident; | |||
) => { | |||
$(#[$outer])* | |||
$vis struct $BitFlags(<Self as $crate::__private::PublicFlags>::Internal); | |||
$vis struct $BitFlags(<$BitFlags as $crate::__private::PublicFlags>::Internal); |
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.
I was getting a build error with Self
being unknown here. Not sure if it was bytemuck
's derives or a change in rustc
but it was easily fixed.
cc @Lokathor 👋 I just wanted to make sure I've got these #[repr(transparent)]
struct FlagsField<T> {
bits: T
} where The impls I've come up with look like this. Does that look right to you? Is there anything else we need to guarantee to make sure these impls are safe to do? |
yep, |
Awesome, thanks for checking them out! 🙇 I'll get this rolling through now. |
Closes #311
I've also added some docs on how to support external libraries here for future contributors. Since the
bytemuck
impls themselves areunsafe
, I've added a note to where we generate our internal flags type warning that its ABI can't be changed.