score_set/breakdown.rs
1//! Structured breakdown of a [`DynamicScoreSet`](crate::DynamicScoreSet) or
2//! [`FiniteScoreSet`](crate::FiniteScoreSet) evaluation — one row per metric.
3
4use crate::float::Float;
5
6/// A single metric's contribution in a score breakdown.
7///
8/// Returned by [`.breakdown()`](crate::DynamicScoreSet::breakdown). Each item
9/// records the metric's name, its raw `[0, 1]` score, its normalized weight,
10/// and the resulting weighted contribution (`score × weight`).
11///
12/// # Fields
13///
14/// | Field | Type | Description |
15/// |---|---|---|
16/// | `name` | `&str` | Metric's human-readable name |
17/// | `score` | `T` | Raw `[0, 1]` score, **before** weighting |
18/// | `weight` | `T` | Normalized weight (`> 0`, sum of all weights = 1) |
19/// | `contribution` | `T` | `score × weight` — what this metric added to the total |
20pub struct Breakdown<'a, T: Float> {
21 /// The metric's human-readable name.
22 pub name: &'a str,
23 /// The raw `[0, 1]` score from the metric (before weighting).
24 pub score: T,
25 /// The normalized weight.
26 pub weight: T,
27 /// The weighted contribution: `score × weight`.
28 pub contribution: T,
29}