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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
//! # score-set
//!
//! A `#![no_std]` + `alloc` Rust library for building **weighted scoring
//! operators** — define metrics via a builder pipeline, combine them into a
//! zero-vtable flat scorer with the [`score_set32!`] macro.
//!
//! # Quick example
//!
//! ```ignore
//! use score_set::*;
//!
//! struct Restaurant {
//! cleanliness: f32,
//! food_quality: f32,
//! }
//!
//! let clean = metric32("cleanliness")
//! .measure()
//! .by(|r: &Restaurant| r.cleanliness)
//! .map01()
//! .linear(100.0);
//!
//! let food = metric32("food")
//! .measure()
//! .by(|r: &Restaurant| r.food_quality)
//! .map01()
//! .identity();
//!
//! let scorer = score_set32! { 2.0 => clean, 1.0 => food }?;
//!
//! let r = Restaurant { cleanliness: 80.0, food_quality: 4.0 };
//! let total: f32 = scorer.score(&r);
//! let rows = scorer.breakdown(&r);
//! # Ok::<(), &'static str>(())
//! ```
//!
//! # Partial application
//!
//! [`by()`](MeasureStage32::by) accepts capturing closures, enabling parameter
//! binding at construction time:
//!
//! ```ignore
//! let threshold: f32 = 0.6;
//! let quality = metric32("quality")
//! .measure()
//! .by(move |ctx: &MyCtx| if ctx.value > threshold { ctx.value } else { 0.0 })
//! .map01()
//! .identity();
//!
//! let scorer = score_set32! { 1.0 => quality }?;
//! // scorer only needs &MyCtx — threshold is baked in
//! ```
//!
//! # no_std
//!
//! This crate is `#![no_std]` with `extern crate alloc` — it only needs
//! `Vec` from the allocator and works on bare-metal targets.
extern crate alloc;
extern crate std;
// Three-state precision selection:
// default → f32 only (ScoreSet32, Metric32, … at crate root)
// f64 → f64 only (ScoreSet64, Metric64, … at crate root)
// f64 + both → f32 + f64 (ScoreSet32 + ScoreSet64 at crate root)
// All modules are private — users only depend on re-exported types.
pub use *;
pub use *;
pub use *;
pub use *;
pub use ;
pub use ;
// Generated score_set32! macro (f32). Active by default and in `both` mode.
// Generated score_set64! macro (f64). Active when `f64` or `both` is enabled.