fastsim_proc_macros/
lib.rs

1mod imports;
2use imports::*;
3mod cumu_method_derive;
4mod cycle_derive;
5mod history_vec_derive;
6mod pyo3_api;
7mod serde_api;
8mod sm_derive;
9mod timer;
10mod utilities;
11
12#[proc_macro_error]
13#[proc_macro_attribute]
14/// Macro for creating appropriate setters and getters for pyo3 struct
15/// attributes and other, non-python API functionality
16pub fn serde_api(attr: TokenStream, item: TokenStream) -> TokenStream {
17    serde_api::serde_api(attr, item)
18}
19
20#[proc_macro_error]
21#[proc_macro_attribute]
22/// Macro for creating appropriate setters and getters for pyo3 struct
23/// attributes and other, non-python API functionality
24pub fn pyo3_api(attr: TokenStream, item: TokenStream) -> TokenStream {
25    pyo3_api::pyo3_api(attr, item)
26}
27
28#[proc_macro_error]
29#[proc_macro_attribute]
30/// macro for creating timing harness
31pub fn timer(attr: TokenStream, item: TokenStream) -> TokenStream {
32    timer::timer(attr, item)
33}
34
35#[proc_macro_derive(HistoryVec, attributes(api))]
36/// Generate HistoryVec that acts like a vec of states but
37/// stores each field of state as a vec field.
38pub fn history_vec_derive(input: TokenStream) -> TokenStream {
39    history_vec_derive::history_vec_derive(input)
40}
41
42#[proc_macro_derive(StateMethods, attributes(has_state))]
43/// Generates remaining `StateMethods` child traits that work for struct and any
44/// nested fields with the `#[has_state]` attribute.
45pub fn state_methods_derive(input: TokenStream) -> TokenStream {
46    sm_derive::state_methods_derive(input)
47}
48
49#[proc_macro_derive(SetCumulative, attributes(has_state))]
50/// Generate `SetCumulative` trait impl that work for struct and any nested
51/// fields with the `#[has_state]` attribute.
52pub fn cumu_method_derive(input: TokenStream) -> TokenStream {
53    cumu_method_derive::cumu_method_derive(input)
54}