feo_oop_engine/macros/
script_macro.rs1#[macro_export]
30macro_rules! start_script {
31 (
32 $( #[$attr:meta] )*
33 $pub:vis
34 async
35 fn start<$lt:lifetime> ($this:tt : $this_ty:ty, $engine_globals:tt : $engine_globals_ty:ty) -> Swap
36 {
37 $($body:tt)*
38 }
39 ) => (
40 $( #[$attr] )*
41 #[allow(unused_parens)]
42 $pub
43 fn start<$lt> ($this : $this_ty, $engine_globals : $engine_globals_ty) -> ::std::pin::Pin<::std::boxed::Box<
44 dyn ::std::future::Future<Output = Swap>
45 + ::std::marker::Send + $lt
46 >>
47 {
48 ::std::boxed::Box::pin(async move {
49 $($body)*
50 })
51 }
52 )
53}
54
55#[macro_export]
56macro_rules! frame_script {
57 (
58 $( #[$attr:meta] )*
59 $pub:vis
60 async
61 fn frame<$lt:lifetime> ($this:tt : $this_ty:ty , $engine_globals:tt : $engine_globals_ty:ty) -> Swap
62 {
63 $($body:tt)*
64 }
65 ) => (
66 $( #[$attr] )*
67 #[allow(unused_parens)]
68 $pub
69 fn frame<$lt> ($this : $this_ty, $engine_globals : $engine_globals_ty) -> ::std::pin::Pin<::std::boxed::Box<
70 dyn ::std::future::Future<Output = Swap>
71 + ::std::marker::Send + $lt
72 >>
73 {
74 ::std::boxed::Box::pin(async move {
75 $($body)*
76 })
77 }
78 )
79}
80
81#[macro_export]
82macro_rules! event_handler {
83 (
84 $( #[$attr:meta] )*
85 $pub:vis
86 async
87 fn event_handler<$lt:lifetime> ($this:tt : $this_ty:ty , $engine_globals:tt : $engine_globals_ty:ty, $event:tt : $event_ty:ty) -> Swap
88 {
89 $($body:tt)*
90 }
91 ) => (
92 $( #[$attr] )*
93 #[allow(unused_parens)]
94 $pub
95 fn event_handler<$lt> ($this : $this_ty, $engine_globals : $engine_globals_ty, $event: $event_ty) -> ::std::pin::Pin<::std::boxed::Box<
96 dyn ::std::future::Future<Output = Swap>
97 + ::std::marker::Send + $lt
98 >>
99 {
100 ::std::boxed::Box::pin(async move {
101 $($body)*
102 })
103 }
104 )
105}