-
Notifications
You must be signed in to change notification settings - Fork 781
Closed
Labels
Description
Input C/C++ Header
typedef enum VkResult {
VK_SUCCESS = 0,
VK_NOT_READY = 1,
// ...
} VkResult;Bindgen Invocation
$ bindgen --no-prepend-enum-name --newtype-enum VkResult input.h
Actual Results
#[repr(transparent)]
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub struct VkResult(pub ::std::os::raw::c_int);
impl VkResult {
pub const VK_SUCCESS: VkResult = VkResult(0);
}
impl VkResult {
pub const VK_NOT_READY: VkResult = VkResult(1);
}
// ...Expected Results
It would be nice if the variants wouldn't be associated constants when --no-prepend-enum-name is specified, but instead would be module constants. Since that would be a breaking change perhaps there could be a new flag like --newtype-global-enum. What do you think?
#[repr(transparent)]
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub struct VkResult(pub ::std::os::raw::c_int);
pub const VK_SUCCESS: VkResult = VkResult(0);
pub const VK_NOT_READY: VkResult = VkResult(1);
// ...