// May only be used when certain crate features are enabled #![allow(unused_macros, unused_imports)] macro_rules! gl_enum { ( $visibility: vis enum $name: ident {$( $variant: ident = gl::$gl_enum: ident, )+} ) => { #[derive(Debug, Clone, Copy)] #[repr(u32)] $visibility enum $name {$( $variant = gl::$gl_enum, )+} impl $name { fn from_gl(num: gl::types::GLenum) -> Option { match num { $(gl::$gl_enum => Some(Self::$variant),)+ _ => None } } } }; } pub(crate) use gl_enum;