You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'd like to use packed_struct in a use case where the rust struct contains an enum, and the enum values are defined by constants generated by bindgen. Modifying the example in the docs shows the behavior I'm seeing:
#![no_std]use packed_struct::prelude::*;// These consts would be imported from the bindgen sources, but just defining consts here works well enough// as an examplepubconstNORMAL:u8 = 0;pubconstPOSITIVE:u8 = 1;pubconstNEGATIVE:u8 = 2;pubconstDEBUG:u8 = 3;#[derive(PrimitiveEnum_u8,Clone,Copy,Debug,PartialEq)]pubenumSelfTestMode{NormalMode = NORMAL,PositiveSignSelfTest = POSITIVE,NegativeSignSelfTest = NEGATIVE,DebugMode = DEBUG,}
I'd like to use
packed_struct
in a use case where the rust struct contains an enum, and the enum values are defined by constants generated bybindgen
. Modifying the example in the docs shows the behavior I'm seeing:Ok, so let's add
#[repr(u8)]
to the enum definition:The text was updated successfully, but these errors were encountered: