macro_rules! offset_of {
($ty:ident::$field:ident) => { ... };
(<$ty:path>::$field:ident) => { ... };
}
Expand description
Constructs an offset from a type and a field name.
The syntax is offset_of!(Type::field)
where Type
is either an ident or
a path in angle brackets.
Example
struct Hello {
message: &'static str,
}
let hello = Hello {
message: "hello world!",
};
assert!(hello.message == *offset::offset_of!(Hello::message).index_in(&hello));