Permalink
Cannot retrieve contributors at this time
Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign up
Find file
Copy path
Fetching contributors…
| #![recursion_limit = "256"] | |
| #![warn(rust_2018_idioms, rust_2018_compatibility)] | |
| extern crate proc_macro; | |
| #[macro_use] | |
| extern crate syn; | |
| #[macro_use] | |
| extern crate quote; | |
| use proc_macro::TokenStream; | |
| use syn::DeriveInput; | |
| mod event_reader; | |
| mod prefab_data; | |
| #[proc_macro_derive(EventReader, attributes(reader))] | |
| pub fn event_reader_derive(input: TokenStream) -> TokenStream { | |
| let ast = parse_macro_input!(input as DeriveInput); | |
| let gen = event_reader::impl_event_reader(&ast); | |
| gen.into() | |
| } | |
| /// Deriving a `Prefab` requires that `amethyst::ecs::Entity` and | |
| /// `amethyst:assets::{PrefabData, PrefabError, ProgressCounter}` are imported | |
| /// and visible in the current scope. This is due to how Rust macros work. | |
| #[proc_macro_derive(PrefabData, attributes(prefab))] | |
| pub fn prefab_data_derive(input: TokenStream) -> TokenStream { | |
| let ast = parse_macro_input!(input as DeriveInput); | |
| let gen = prefab_data::impl_prefab_data(&ast); | |
| gen.into() | |
| } |