I'm working on a Rust library that is used from C. I have an enum that is used to represent errors. I would like to automatically generate a header file with constants for each of the enum variants. That way the Rust code can return an integer (by converting the enum variant to an int), and the C program can use that to determine the error message.
I was wondering if this is possible, or do I need to manually generate the constants in the header file?
Furthermore, I'm not sure how to convert the enum into an integer. This only seems possible for simple enums.