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
//! # score-set
//!
//! A Rust library for building **weighted scoring operators** as composable
//! closures.
//!
//! Define metrics via a builder pipeline, combine them with weights, and
//! produce a closure — either a weighted sum function or a breakdown iterator.
//! The downstream caller only sees `impl Fn(&C) -> f32` (or `f64`) or
//! `impl Fn(&C) -> Vec<Breakdown>`.
//!
//! # Quick example
//!
//! ```ignore
//! use score_set::*;
//!
//! struct DnaCtx<'a> {
//! dna: &'a str,
//! len: usize,
//! }
//!
//! let gc = metric32("gc")
//! .measure()
//! .by(|ctx: &DnaCtx| gc_ratio(ctx.dna) as f32)
//! .map01()
//! .identity();
//!
//! let len = metric32("len")
//! .measure()
//! .by(|ctx: &DnaCtx| ctx.len as f32)
//! .map01()
//! .linear(100.0);
//!
//! let scorer = ScoreSet32::new()
//! .push(2.0, gc)?
//! .push(1.0, len)?
//! .sum()?;
//!
//! let ctx = DnaCtx { dna: "ACGTACGT", len: 8 };
//! let total = scorer(&ctx);
//! # Ok::<(), &'static str>(())
//! ```
//!
//! # no_std
//!
//! This crate is `#![no_std]` with `extern crate alloc` — it only needs
//! `Vec` and `String` 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 ;