pub const fn offset_of<T: PointeeSized>(variant: u32, field: u32) -> usize🔬This is a nightly-only experimental API. (
core_intrinsics)Expand description
The offset of a field inside a type.
Note that, unlike most intrinsics, this is safe to call;
it does not require an unsafe block.
Therefore, implementations must not require the user to uphold
any safety invariants.
This intrinsic can only be evaluated at compile-time, and should only appear in constants or inline const blocks.
The stabilized version of this intrinsic is core::mem::offset_of.
This intrinsic is also a lang item so offset_of! can desugar to calls to it.