gltf_viewer_lib/macros.rs
1#![macro_use]
2
3/// Get offset to struct member, similar to `offset_of` in C/C++
4/// From [here](https://stackoverflow.com/questions/40310483/how-to-get-pointer-offset-in-bytes/40310851#40310851)
5macro_rules! offset_of {
6 ($ty:ty, $field:ident) => {
7 &(*(ptr::null() as *const $ty)).$field as *const _ as usize
8 }
9}