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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
//! Declarative macros that consolidate constructor boilerplate for
//! architecture detectors.
//!
//! Most architecture detectors share three near-identical constructors:
//! - `pub fn new() -> Self` — defaults
//! - `pub fn with_config(DetectorConfig) -> Self` — reads thresholds via
//! `config.get_option_or(key, default)`
//! - `impl Default for X { fn default() -> Self { Self::new() } }`
//!
//! The [`detector_constructors!`] macro generates all three from a single
//! declarative invocation. Detectors retain their own struct definitions so
//! that field types remain explicit at use sites (e.g., inside the `Detector`
//! trait impl).
//!
//! # Examples
//!
//! Config-only detector:
//!
//! ```ignore
//! pub struct ShotgunSurgeryDetector { config: DetectorConfig }
//!
//! detector_constructors! {
//! ShotgunSurgeryDetector { }
//! }
//! ```
//!
//! Detector with one or more numeric threshold fields:
//!
//! ```ignore
//! pub struct MutualRecursionDetector {
//! config: DetectorConfig,
//! max_cycle_size: usize,
//! }
//!
//! detector_constructors! {
//! MutualRecursionDetector {
//! max_cycle_size: usize = config_opt("max_cycle_size", 50),
//! }
//! }
//! ```
//!
//! Detectors with bespoke construction logic (e.g., calibrate-aware
//! multipliers in `architectural_bottleneck.rs` and `degree_centrality.rs`)
//! intentionally do not use this macro.
/// Generate `new()`, `with_config(DetectorConfig)`, and `Default` for an
/// architecture detector with a `config` field plus zero or more numeric
/// threshold fields, each backed by a config option.
///
/// See the module docs for usage.
) => ;
}
pub use detector_constructors;