Merge pull request #101 from Ralith/raw-enums

Expose conversions between enums and raw values
This commit is contained in:
Maik Klein 2018-08-21 14:13:57 +02:00 committed by GitHub
commit 2f60f8f1d5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
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() {