1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
// #![deny(missing_docs)]
// #![warn(clippy::missing_docs_in_private_items)]

// Note that this way of importing the macros relies on the order in which the modules get
// imported.
#[macro_use]
mod cell_agent;
#[macro_use]
mod subdomain;
mod domain;

/// Derive cellular concepts
///
/// This macro allows to simply derive already implemented concepts
/// from struct fields.
/// Currently the only allowed notation is by defining macros with curly braces.
/// ```ignore
/// #[derive(CellAgent)]
/// struct MyCell {
///     #[Cycle]
///     cycle: MyCycle,
///     ...
/// }
/// ```
#[proc_macro_derive(
    CellAgent,
    attributes(
        Cycle,
        Mechanics,
        MechanicsRaw,
        Position,
        Velocity,
        Interaction,
        Reactions,
        ReactionsRaw,
        Intracellular,
        ExtracellularGradient,
    )
)]
pub fn derive_cell_agent(input: proc_macro::TokenStream) -> proc_macro::TokenStream {
    cell_agent::derive_cell_agent(input)
}

#[proc_macro_derive(SubDomain, attributes(Base, SortCells, Mechanics, Force, Reactions))]
pub fn derive_subdomain(input: proc_macro::TokenStream) -> proc_macro::TokenStream {
    subdomain::derive_subdomain(input)
}

#[proc_macro_derive(
    Domain,
    attributes(
        Base,
        DomainPartialDerive,
        DomainRngSeed,
        DomainCreateSubDomains,
        SortCells
    )
)]
pub fn derive_domain(input: proc_macro::TokenStream) -> proc_macro::TokenStream {
    domain::derive_domain(input)
}