feat: PartialEq on the config types, and pin the public trait impls
`Rating` already derived `PartialEq`, but that derive is only reachable through `D: PartialEq` — and `ConstantDrift`, the crate's own only `Drift` impl, did not satisfy it. So the derive was there and unusable. Found by writing the comparison from a consumer's position rather than reading the derive list. `ConstantDrift`, `ConvergenceOptions` and `GameOptions` now derive `PartialEq`. All three are pure configuration; comparing two is the natural thing to want and nothing about them makes equality ambiguous. `tests/trait_impls.rs` pins the surface, written the way the failure was reported: a consumer struct that *holds* a `History` and derives `Debug`. It also asserts `History`'s `Debug` summarises rather than dumping its skill stores, so a future derive cannot quietly replace the hand-written impl. `Clone` on `History` stays off. It is a decision, not an omission: a history owns every slice's skill store and arena, so cloning one is proportional to the whole fit, and no consumer has wanted it. Closes #76. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011hcFjNDmHXZF8URGLku5zZ
This commit is contained in:
+1
-1
@@ -4,7 +4,7 @@ use std::time::Duration;
|
||||
|
||||
use smallvec::SmallVec;
|
||||
|
||||
#[derive(Clone, Copy, Debug)]
|
||||
#[derive(Clone, Copy, Debug, PartialEq)]
|
||||
pub struct ConvergenceOptions {
|
||||
pub max_iter: usize,
|
||||
pub epsilon: f64,
|
||||
|
||||
+1
-1
@@ -43,7 +43,7 @@ pub trait Drift<T: Time>: Copy + Debug + Send + Sync {
|
||||
/// A non-finite gamma is caught a second time regardless:
|
||||
/// `History::converge` validates the drift variance each competitor actually
|
||||
/// accumulates, which also covers a custom [`Drift`] implementation.
|
||||
#[derive(Clone, Copy, Debug)]
|
||||
#[derive(Clone, Copy, Debug, PartialEq)]
|
||||
pub struct ConstantDrift(f64);
|
||||
|
||||
impl ConstantDrift {
|
||||
|
||||
+1
-1
@@ -68,7 +68,7 @@ impl DiffFactor {
|
||||
/// `p_draw` and `convergence` apply to ranked outcomes (`Game::ranked`).
|
||||
/// `score_sigma` applies only to scored outcomes (`Game::scored`); it controls
|
||||
/// how much the engine trusts the observed score margin (smaller σ = more trust).
|
||||
#[derive(Clone, Copy, Debug)]
|
||||
#[derive(Clone, Copy, Debug, PartialEq)]
|
||||
pub struct GameOptions {
|
||||
pub p_draw: f64,
|
||||
pub score_sigma: f64,
|
||||
|
||||
Reference in New Issue
Block a user