How does one go about in getting the size of a struct member. The below code works but only due to it being able to use the member via the instance of TransportHeader.
pub fn size(flags: u32) u16 {
const t = TransportHeader {};
var res : u16 = 0;
if (Flags.hasTag(flags)) {
res += @sizeOf(@TypeOf(t.messageNo));
}
return res;
}
}
It is obvious that a non static member is not accessible without an instance (or similar), at least in these circumstances, so my gut is telling me that I am missing some magic.
Big thank you. Your recommendation works. I was not expecting this type of “member” as string to be the solution, but makes 100% sense given the problem.