-
-
Notifications
You must be signed in to change notification settings - Fork 20
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
check bytes of repr(C) enums #15
Comments
|
I'm trying to send archived data structures over a network and use |
Awesome! I'll add an enum example to the book to make it clearer. |
so reopening. it's still a problem when using |
When using |
Well it's set to repr(C) but it claims it isn't |
Hmm, this might be really dumb but do you have the |
Maybe I'm doing something wrong... use bytecheck::CheckBytes;
#[derive(CheckBytes)]
#[repr(C)]
pub enum AnEnum {
Var(u8),
Other(u16),
}
fn main() {
println!("Hello, world!");
} error: archive self enums must be repr(C) or repr(Int)
--> src/main.rs:4:8
|
4 | #[repr(C)]
| ^
error: aborting due to previous error |
Okay, I have located the issue. Thanks for your patience. That error is outdated and inaccurate. Right now |
if that's the case I'm a bit confused why this works: use bytecheck::CheckBytes;
use rkyv::Archive;
#[derive(Archive)]
#[archive_attr(derive(CheckBytes))]
#[repr(C)]
pub enum AnEnum {
Var(u8),
Other(u16),
}
fn main() {
println!("Hello, world!");
} is |
Yes, rkyv will always generate archived enums that are |
As an update, I'm no longer planning on adding this myself since I have no need for repr(C) enums. I would not turn down a PR though! |
any way to do it? I guess repr(C) is not defined on enums, although I'd hope it would generate something like this:
The text was updated successfully, but these errors were encountered: