feo_oop_engine_proc_macros/lib.rs
1//! [![github]](https://github.com/littleTitan/feo-oop-engine-proc-macros) [![crates-io]](https://crates.io/crates/feo-oop-engine-proc-macros) [![docs-rs]](crate)
2//!
3//! [github]: https://img.shields.io/badge/github-8da0cb?style=for-the-badge&labelColor=555555&logo=github
4//! [crates-io]: https://img.shields.io/badge/crates.io-fc8d62?style=for-the-badge&labelColor=555555&logo=rust
5//! [docs-rs]: https://img.shields.io/badge/docs.rs-66c2a5?style=for-the-badge&labelColor=555555&logoColor=white&logo=data:image/svg+xml;base64,PHN2ZyByb2xlPSJpbWciIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgdmlld0JveD0iMCAwIDUxMiA1MTIiPjxwYXRoIGZpbGw9IiNmNWY1ZjUiIGQ9Ik00ODguNiAyNTAuMkwzOTIgMjE0VjEwNS41YzAtMTUtOS4zLTI4LjQtMjMuNC0zMy43bC0xMDAtMzcuNWMtOC4xLTMuMS0xNy4xLTMuMS0yNS4zIDBsLTEwMCAzNy41Yy0xNC4xIDUuMy0yMy40IDE4LjctMjMuNCAzMy43VjIxNGwtOTYuNiAzNi4yQzkuMyAyNTUuNSAwIDI2OC45IDAgMjgzLjlWMzk0YzAgMTMuNiA3LjcgMjYuMSAxOS45IDMyLjJsMTAwIDUwYzEwLjEgNS4xIDIyLjEgNS4xIDMyLjIgMGwxMDMuOS01MiAxMDMuOSA1MmMxMC4xIDUuMSAyMi4xIDUuMSAzMi4yIDBsMTAwLTUwYzEyLjItNi4xIDE5LjktMTguNiAxOS45LTMyLjJWMjgzLjljMC0xNS05LjMtMjguNC0yMy40LTMzLjd6TTM1OCAyMTQuOGwtODUgMzEuOXYtNjguMmw4NS0zN3Y3My4zek0xNTQgMTA0LjFsMTAyLTM4LjIgMTAyIDM4LjJ2LjZsLTEwMiA0MS40LTEwMi00MS40di0uNnptODQgMjkxLjFsLTg1IDQyLjV2LTc5LjFsODUtMzguOHY3NS40em0wLTExMmwtMTAyIDQxLjQtMTAyLTQxLjR2LS42bDEwMi0zOC4yIDEwMiAzOC4ydi42em0yNDAgMTEybC04NSA0Mi41di03OS4xbDg1LTM4Ljh2NzUuNHptMC0xMTJsLTEwMiA0MS40LTEwMi00MS40di0uNmwxMDItMzguMiAxMDIgMzguMnYuNnoiPjwvcGF0aD48L3N2Zz4K
6//!
7//! Procedural macros for [feo-oop-engine](https://github.com/littletitan/feo-oop-engine)
8#[cfg(feature = "child")] mod child_macro_derive;
9#[cfg(feature = "drawable")] mod drawable_macro_derive;
10#[cfg(feature = "gameobject")] mod gameobject_macro_derive;
11#[cfg(feature = "global")] mod global_macro_derive;
12#[cfg(feature = "named")] mod named_macro_derive;
13#[cfg(feature = "parent")] mod parent_macro_derive;
14#[cfg(feature = "scriptable")] mod scriptable_macro_derive;
15
16use proc_macro::TokenStream;
17
18/// <span class="stab portability" title="This is supported on crate feature `child` only"><code>
19/// feature = child
20/// </code></span>
21#[cfg(feature = "child")]
22#[proc_macro_derive(Child)]
23pub fn child_macro_derive(input: TokenStream) -> TokenStream {
24 let ast = syn::parse(input).unwrap();
25
26 child_macro_derive::impl_child_macro(&ast)
27}
28
29/// <span class="stab portability" title="This is supported on crate feature `drawable` only"><code>
30/// feature = drawable
31/// </code></span>
32#[cfg(feature = "drawable")]
33#[proc_macro_derive(Drawable, attributes(light))]
34pub fn drawable_macro_derive(input: TokenStream) -> TokenStream {
35 let ast = syn::parse(input).unwrap();
36
37 drawable_macro_derive::impl_drawable_macro(&ast)
38}
39
40/// <span class="stab portability" title="This is supported on crate feature `gameobject` only"><code>
41/// feature = gameobject
42/// </code></span>
43#[cfg(feature = "gameobject")]
44#[proc_macro_derive(GameObject, attributes(camera))]
45pub fn gameobject_macro_derive(input: TokenStream) -> TokenStream {
46 let ast = syn::parse(input).unwrap();
47
48 gameobject_macro_derive::impl_gameobject_macro(&ast)
49}
50
51/// <span class="stab portability" title="This is supported on crate feature `global` or `default` only"><code>
52/// feature = global or default
53/// </code></span>
54#[cfg(feature = "global")]
55#[proc_macro_derive(Global)]
56pub fn global_macro_derive(input: TokenStream) -> TokenStream {
57 let ast = syn::parse(input).unwrap();
58
59 global_macro_derive::impl_global_macro(&ast)
60}
61
62/// <span class="stab portability" title="This is supported on crate feature `named` only"><code>
63/// feature = named
64/// </code></span>
65#[cfg(feature = "named")]
66#[proc_macro_derive(Named)]
67pub fn named_macro_derive(input: TokenStream) -> TokenStream {
68 let ast = syn::parse(input).unwrap();
69
70 named_macro_derive::impl_named_macro(&ast)
71}
72
73
74/// <span class="stab portability" title="This is supported on crate feature `parent` only"><code>
75/// feature = parent
76/// </code></span>
77#[cfg(feature = "parent")]
78#[proc_macro_derive(Parent)]
79pub fn parent_macro_derive(input: TokenStream) -> TokenStream {
80 let ast = syn::parse(input).unwrap();
81
82 parent_macro_derive::impl_parent_macro(&ast)
83}
84
85/// <span class="stab portability" title="This is supported on crate feature `scriptable` only"><code>
86/// feature = scriptable
87/// </code></span>
88#[cfg(feature = "scriptable")]
89#[proc_macro_derive(Scriptable)]
90pub fn scriptable_macro_derive(input: TokenStream) -> TokenStream {
91 let ast = syn::parse(input).unwrap();
92
93 scriptable_macro_derive::impl_scriptable_macro(&ast)
94}