cellular_raza_concepts_derive/
lib.rs

1// #![deny(missing_docs)]
2// #![warn(clippy::missing_docs_in_private_items)]
3
4// Note that this way of importing the macros relies on the order in which the modules get
5// imported.
6#[macro_use]
7mod cell_agent;
8#[macro_use]
9mod subdomain;
10mod domain;
11
12/// Derive cellular concepts
13///
14/// This macro allows to simply derive already implemented concepts
15/// from struct fields.
16/// Currently the only allowed notation is by defining macros with curly braces.
17/// ```ignore
18/// #[derive(CellAgent)]
19/// struct MyCell {
20///     #[Cycle]
21///     cycle: MyCycle,
22///     ...
23/// }
24/// ```
25#[proc_macro_derive(
26    CellAgent,
27    attributes(
28        Cycle,
29        Mechanics,
30        MechanicsRaw,
31        Position,
32        Velocity,
33        Interaction,
34        Reactions,
35        ReactionsContact,
36        ReactionsRaw,
37        ReactionsExtra,
38        ReactionsExtraRaw,
39        Intracellular,
40        ExtracellularGradient,
41    )
42)]
43pub fn derive_cell_agent(input: proc_macro::TokenStream) -> proc_macro::TokenStream {
44    cell_agent::derive_cell_agent(input)
45}
46
47#[proc_macro_derive(SubDomain, attributes(Base, SortCells, Mechanics, Force, Reactions))]
48pub fn derive_subdomain(input: proc_macro::TokenStream) -> proc_macro::TokenStream {
49    subdomain::derive_subdomain(input)
50}
51
52#[proc_macro_derive(
53    Domain,
54    attributes(
55        Base,
56        DomainPartialDerive,
57        DomainRngSeed,
58        DomainCreateSubDomains,
59        SortCells
60    )
61)]
62pub fn derive_domain(input: proc_macro::TokenStream) -> proc_macro::TokenStream {
63    domain::derive_domain(input)
64}