Expose conversions between enums and raw values

This commit is contained in:
Benjamin Saunders 2018-08-20 23:56:33 -07:00
parent e546fbbb5d
commit d5666554fc
2 changed files with 2545 additions and 1959 deletions

File diff suppressed because it is too large Load diff

View file

@ -1037,6 +1037,10 @@ pub fn generate_enum<'a>(
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)]
#[repr(transparent)]
pub struct #ident(pub(crate) i32);
impl #ident {
pub fn from_raw(x: i32) -> Self { #ident(x) }
pub fn as_raw(self) -> i32 { self.0 }
}
#impl_block
};
let special_quote = match _name.as_str() {