Is there a way to specify the offset of each of the fields in a rust struct?
For background, I am working on a project that needs to read structs from the memory of other processes. There are large parts of these structs that contain unknown data, so I want to be able to specify the offset of each field I do know so that I can just directly copy bytes from the target process to the relevant struct, which would be much easier to maintain and read than having to manually convert from a byte array to the final format.
I have tried inserting private _pad: [u8; x] fields but this prevents me from deriving pretty much any traits on the struct and is really likely to cause errors if eg. I need to add a field.
I'm basically looking for something along the lines of C#'s
FieldOffset [https://docs.microsoft.com/en-us/dotnet/api/system.runtime.interopservices.fieldoffsetattribute?view=netcore-3.1](docs page) feature.