containerof::containerof_field_offset! [] [src]

macro_rules! containerof_field_offset {
    ($container:ty : $field:ident) => (unsafe {
        &(*(0usize as *const $container)).$field as *const _ as usize
    })
}

Implement C-like offsetof macro in Rust. Will become obsolete when-and-if offsetof() is implemented in the core language.