addr_of_enum
This crate provides #[derive(AddrOfEnum)] and addr_of_enum! macro to get a field pointer of specified variant without creating an intermediated reference. It works like std::ptr::addr_of!, but works only on enums.
This macro is zero-cost, which means that it calculates without minimum cost in release mode.
It also works on variables which has uninhabited types.
Example
# use ;
let e = E1;
let _: *const usize = addr_of_enum!;
let _: *const u32 = addr_of_enum!;
Limitations
For now, the macros cannot be used in const context.