1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
extern crate proc_macro;

mod attribute;
mod target;
mod uniform;

use ::syn::{GenericParam, Generics, TypeParamBound};
fn add_trait_bounds(mut generics: Generics, params: Vec<TypeParamBound>) -> Generics {
    for param in &mut generics.params {
        if let GenericParam::Type(ref mut type_param) = *param {
            for param in &params{
                type_param.bounds.push(param.clone());
            }
        }
    }
    generics
}

use ::proc_macro::TokenStream;
#[proc_macro]
pub fn gl_target(input: TokenStream) -> TokenStream {
    target::gl_target(input)
}

///Create a ToUniform implementaion from the given struct.
#[proc_macro_derive(ToUniform)]
pub fn gl_to_uniform(input: TokenStream) -> TokenStream {
    uniform::gl_to_uniform(input)
}
///Create a ToAttribute implementaion from the given struct.
#[proc_macro_derive(ToAttribute)]
pub fn gl_to_attribute(input: TokenStream) -> TokenStream {
    attribute::gl_to_attribute(input)
}