ixa/macros/value_change_counts.rs
1/// Tracks periodic value change counts with concise entity, property, and strata syntax.
2///
3/// The strata list is optional. Omitting it, or passing `[]`, uses the empty
4/// property list `()`.
5///
6/// ```ignore
7/// track_periodic_value_change_counts!(
8/// context,
9/// Person,
10/// InfectionStatus,
11/// 1.0,
12/// handle_incidence_tracking
13/// );
14///
15/// track_periodic_value_change_counts!(
16/// context,
17/// Person,
18/// InfectionStatus,
19/// [Age],
20/// 1.0,
21/// move |_context, counter| {
22/// let _ = counter;
23/// }
24/// );
25///
26/// track_periodic_value_change_counts!(
27/// context,
28/// Person,
29/// InfectionStatus,
30/// [Age, HighRisk],
31/// 1.0,
32/// handle_incidence_tracking
33/// );
34/// ```
35#[macro_export]
36macro_rules! track_periodic_value_change_counts {
37 ($context:expr, $entity:ty, $property:ty, [$($stratum:ty),* $(,)?], $period:expr, $handler:expr $(,)?) => {
38 ($context).track_periodic_value_change_counts::<$entity, ($($stratum,)*), $property, _>(
39 $period,
40 $handler,
41 )
42 };
43
44 ($context:expr, $entity:ty, $property:ty, $period:expr, $handler:expr $(,)?) => {
45 track_periodic_value_change_counts!($context, $entity, $property, [], $period, $handler)
46 };
47}