Macro glitter::offset_of
[−]
[src]
macro_rules! offset_of { ($T:ty, $field:ident) => { ... }; }
Compute the offset of a field within a struct type.
Examples
#[repr(C, packed)] struct MyStruct { foo: u32, bar: u32, baz: u32 } assert_eq!(offset_of!(MyStruct, foo), 0); assert_eq!(offset_of!(MyStruct, bar), 4); assert_eq!(offset_of!(MyStruct, baz), 8);