I need to serialize a struct to [u8] but remove any gaps between members.
Also, when deserializing [u8] to the struct, any necessary gaps must be added back.
I can define a repr(packed)
and a repr(rust)
version for this structure, but I have several such kinds of structures. This makes the work rather boring.
Is there any better way to do this?
Or is there a way to automatically generate repr(rust)
and repr(packed)
versions of a structure?
Thanks!
My final solution:
use packed_struct
Sorry, I accessed the wrong forum…