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
// ---------------- [ File: capability-feature-measurement/src/depth_breadth_density.rs ]
crateix!;
/// We want to define a trait hierarchy for "measuring" each portion of a `GrowerTreeConfiguration`
/// against arbitrary tree-like data structures (e.g., `Skeleton`, `StringSkeleton`, or others).
///
/// These traits let us measure or infer the real state of a tree structure, so that client code
/// can compare "actual" vs. "expected" parameters in a generic way.
///
/// **Naming Conventions**:
/// - Each trait is named `TreeXyzMeasurer`, where `Xyz` aligns with a portion of the config.
/// - Each trait method is named `measure_tree_xyz(...)`.
/// - Associated data types similarly use `TreeXyz...` naming, with no public fields.
/// Instead, we rely on private fields with accessor methods as needed (`getset`/`derive_builder`).
///
/// **Implementation Strategy**:
/// - For each data structure type (e.g., `Skeleton`, `StringSkeleton`), implement these traits
/// to provide the correct measurements.
/// - Some parameters (like `leaf_granularity`, etc.) might be purely derived
/// from config or environment, so the measurement method can return `None` or a default.
/// ---------------------------------------------------------------------------
/// 1) Depth
/// ---------------------------------------------------------------------------
/// Provides a way to measure the **maximum depth** of a tree-like structure.
///
/// Implementations might do BFS/DFS to compute the maximum path length from root to leaves.
/// ---------------------------------------------------------------------------
/// 2) Breadth (Baseline Child Count)
/// ---------------------------------------------------------------------------
/// Provides a way to measure child counts (breadth) for each node in a tree structure.
/// ---------------------------------------------------------------------------
/// 3) Density (Leaf Variants or Leaf Count)
/// ---------------------------------------------------------------------------
/// Provides a way to measure "leaf variants" or `leaf_count` at each node.
/// Some data structures track `leaf_count` explicitly; others might calculate it from subtrees.