Macro kernel::offset_of[][src]

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.

Example

struct Test {
    a: u64,
    b: u32,
}

fn test() {
    // This prints `8`.
    pr_info!("{}\n", offset_of!(Test, b));
}