packed_struct.rs icon indicating copy to clipboard operation
packed_struct.rs copied to clipboard

usize fields

Open danking opened this issue 1 year ago • 0 comments

Thanks for maintaining this great crate!

I can't seem to figure out how to have a PackedStruct whose fields are usize. Is there any intention to support this as long as the user asserts a width for the usize?

Thanks kindly

#[derive(Clone, Debug, PackedStruct)]
#[packed_struct(endian = "lsb")]
pub struct BoolMetadata {
    #[packed_field(element_size_bits = "8", ty = "enum")]
    validity: ValidityMetadata,
    #[packed_field(element_size_bits = "8")]
    length: usize,
    #[packed_field(element_size_bits = "8")]
    bit_offset: usize,
}

danking avatar Sep 20 '24 17:09 danking