altrios_proc_macros/
lib.rs

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