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        InteractionRaw,
35        InteractionInformation,
36        NeighborSensing,
37        NeighborSensingRaw,
38        Reactions,
39        ReactionsContact,
40        ReactionsRaw,
41        ReactionsExtra,
42        ReactionsExtraRaw,
43        Intracellular,
44        ExtracellularGradient,
45    )
46)]
47pub fn derive_cell_agent(input: proc_macro::TokenStream) -> proc_macro::TokenStream {
48    cell_agent::derive_cell_agent(input)
49}
50
51#[proc_macro_derive(SubDomain, attributes(Base, SortCells, Mechanics, Force, Reactions))]
52pub fn derive_subdomain(input: proc_macro::TokenStream) -> proc_macro::TokenStream {
53    subdomain::derive_subdomain(input)
54}
55
56#[proc_macro_derive(
57    Domain,
58    attributes(
59        Base,
60        DomainPartialDerive,
61        DomainRngSeed,
62        DomainCreateSubDomains,
63        SortCells
64    )
65)]
66pub fn derive_domain(input: proc_macro::TokenStream) -> proc_macro::TokenStream {
67    domain::derive_domain(input)
68}