Discriminant
Convert a enum (with or without field) with #[repr(...)] to corresponding type. Compatible with #![no_std].
Tested on rust-2021 and rust-2024
Examples
use Discriminant;
Credits
I had been seen such an approach on StackOverflow long time ago, but I can not find the original post, to make it convenient for other developers dealing with lower level data struct, I made this crate. Thank for the author on StackOverflow.