`addr_of!` for enums?

Given the name of an enum, the name of a variant, and the name of a field within that variant, is there any way (outside of a proc macro) to calculate the address or offset of that field? I'm thinking roughly of an analogue to addr_of!, but IIUC there's no way to feed an expression to addr_of! that would make it work for this case.

There's discussion here for offset_of!:

3 Likes

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.