offset_of! slices
Summary
The article explores a Rust macro technique to compute the byte offset of a struct field, including slice fields, at compile time. It walks through a custom macro example that borrows a fake instance and unsafe pointer casts to derive the offset, discusses limitations (e.g., unsized fields, memory bounds), and situates this in the ecosystem of crates and prior approaches.