macro_rules! offset_of {
($type:ty, $($f:tt)*) => { ... };
}
Expand description
Calculates the offset of a field from the beginning of the struct it belongs to.
Examples
struct Test {
a: u64,
b: u32,
}
assert_eq!(offset_of!(Test, b), 8);